diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2002-08-01 15:06:25 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2002-08-01 15:06:25 +0000 |
commit | 8e90d2018cc807e9381330783d923b4efaee9786 (patch) | |
tree | 8a08f5cea02bb471095f5e5d605f705c37d68f6f | |
parent | ef74d743a0b5446376de4e40583968696bb703b3 (diff) | |
download | zsh-8e90d2018cc807e9381330783d923b4efaee9786.tar.gz zsh-8e90d2018cc807e9381330783d923b4efaee9786.tar.xz zsh-8e90d2018cc807e9381330783d923b4efaee9786.zip |
Dan Nelson: 17492: Quote output from xtrace
-rw-r--r-- | Src/builtin.c | 12 | ||||
-rw-r--r-- | Src/cond.c | 11 | ||||
-rw-r--r-- | Src/exec.c | 16 |
3 files changed, 26 insertions, 13 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index 683cf0506..9bcbbb08f 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -369,10 +369,14 @@ execbuiltin(LinkList args, Builtin bn) if (xtr) { printprompt4(); fprintf(xtrerr, "%s", name); - if (xarg) - fprintf(xtrerr, " %s", xarg); - while (*oargv) - fprintf(xtrerr, " %s", *oargv++); + if (xarg) { + fputc(' ', xtrerr); + quotedzputs(xarg, xtrerr); + } + while (*oargv) { + fputc(' ', xtrerr); + quotedzputs(*oargv++, xtrerr); + } fputc('\n', xtrerr); fflush(xtrerr); } diff --git a/Src/cond.c b/Src/cond.c index 4a4dc24ed..4cc516924 100644 --- a/Src/cond.c +++ b/Src/cond.c @@ -147,9 +147,14 @@ evalcond(Estate state) singsub(&rt); untokenize(rt); } - fprintf(xtrerr, " %s %s %s", left, condstr[ctype], rt); - } else - fprintf(xtrerr, " -%c %s", ctype, left); + fputc(' ',xtrerr); + quotedzputs(left, xtrerr); + fprintf(xtrerr, " %s ", condstr[ctype]); + quotedzputs(rt, xtrerr); + } else { + fprintf(xtrerr, " -%c ", ctype); + quotedzputs(left, xtrerr); + } } if (ctype >= COND_EQ && ctype <= COND_GE) { diff --git a/Src/exec.c b/Src/exec.c index 04a141679..494c1c260 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1278,7 +1278,7 @@ makecline(LinkList list) for (node = firstnode(list); node; incnode(node)) { *ptr++ = (char *)getdata(node); - zputs(getdata(node), xtrerr); + quotedzputs(getdata(node), xtrerr); if (nextnode(node)) fputc(' ', xtrerr); } @@ -1548,8 +1548,10 @@ addvars(Estate state, Wordcode pc, int export) untokenize(peekfirst(vl)); val = ztrdup(ugetnode(vl)); } - if (xtr) - fprintf(xtrerr, "%s ", val); + if (xtr) { + quotedzputs(val, xtrerr); + fputc(' ', xtrerr); + } if (export && !strchr(name, '[')) { if (export < 0 && isset(RESTRICTED) && (pm = (Param) paramtab->removenode(paramtab, name)) && @@ -1589,8 +1591,10 @@ addvars(Estate state, Wordcode pc, int export) *ptr = NULL; if (xtr) { fprintf(xtrerr, "( "); - for (ptr = arr; *ptr; ptr++) - fprintf(xtrerr, "%s ", *ptr); + for (ptr = arr; *ptr; ptr++) { + quotedzputs(*ptr, xtrerr); + fputc(' ', xtrerr); + } fprintf(xtrerr, ") "); } assignaparam(name, arr, WC_ASSIGN_TYPE2(ac) == WC_ASSIGN_INC); @@ -3207,7 +3211,7 @@ execshfunc(Shfunc shf, LinkList args) for (lptr = firstnode(args); lptr; incnode(lptr)) { if (lptr != firstnode(args)) fputc(' ', xtrerr); - fprintf(xtrerr, "%s", (char *)getdata(lptr)); + quotedzputs((char *)getdata(lptr), xtrerr); } fputc('\n', xtrerr); fflush(xtrerr); |