1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-30 05:40:58 +01:00

Dan Nelson: 17492: Quote output from xtrace

This commit is contained in:
Peter Stephenson 2002-08-01 15:06:25 +00:00
parent ef74d743a0
commit 8e90d2018c
3 changed files with 26 additions and 13 deletions

View file

@ -369,10 +369,14 @@ execbuiltin(LinkList args, Builtin bn)
if (xtr) { if (xtr) {
printprompt4(); printprompt4();
fprintf(xtrerr, "%s", name); fprintf(xtrerr, "%s", name);
if (xarg) if (xarg) {
fprintf(xtrerr, " %s", xarg); fputc(' ', xtrerr);
while (*oargv) quotedzputs(xarg, xtrerr);
fprintf(xtrerr, " %s", *oargv++); }
while (*oargv) {
fputc(' ', xtrerr);
quotedzputs(*oargv++, xtrerr);
}
fputc('\n', xtrerr); fputc('\n', xtrerr);
fflush(xtrerr); fflush(xtrerr);
} }

View file

@ -147,9 +147,14 @@ evalcond(Estate state)
singsub(&rt); singsub(&rt);
untokenize(rt); untokenize(rt);
} }
fprintf(xtrerr, " %s %s %s", left, condstr[ctype], rt); fputc(' ',xtrerr);
} else quotedzputs(left, xtrerr);
fprintf(xtrerr, " -%c %s", ctype, left); fprintf(xtrerr, " %s ", condstr[ctype]);
quotedzputs(rt, xtrerr);
} else {
fprintf(xtrerr, " -%c ", ctype);
quotedzputs(left, xtrerr);
}
} }
if (ctype >= COND_EQ && ctype <= COND_GE) { if (ctype >= COND_EQ && ctype <= COND_GE) {

View file

@ -1278,7 +1278,7 @@ makecline(LinkList list)
for (node = firstnode(list); node; incnode(node)) { for (node = firstnode(list); node; incnode(node)) {
*ptr++ = (char *)getdata(node); *ptr++ = (char *)getdata(node);
zputs(getdata(node), xtrerr); quotedzputs(getdata(node), xtrerr);
if (nextnode(node)) if (nextnode(node))
fputc(' ', xtrerr); fputc(' ', xtrerr);
} }
@ -1548,8 +1548,10 @@ addvars(Estate state, Wordcode pc, int export)
untokenize(peekfirst(vl)); untokenize(peekfirst(vl));
val = ztrdup(ugetnode(vl)); val = ztrdup(ugetnode(vl));
} }
if (xtr) if (xtr) {
fprintf(xtrerr, "%s ", val); quotedzputs(val, xtrerr);
fputc(' ', xtrerr);
}
if (export && !strchr(name, '[')) { if (export && !strchr(name, '[')) {
if (export < 0 && isset(RESTRICTED) && if (export < 0 && isset(RESTRICTED) &&
(pm = (Param) paramtab->removenode(paramtab, name)) && (pm = (Param) paramtab->removenode(paramtab, name)) &&
@ -1589,8 +1591,10 @@ addvars(Estate state, Wordcode pc, int export)
*ptr = NULL; *ptr = NULL;
if (xtr) { if (xtr) {
fprintf(xtrerr, "( "); fprintf(xtrerr, "( ");
for (ptr = arr; *ptr; ptr++) for (ptr = arr; *ptr; ptr++) {
fprintf(xtrerr, "%s ", *ptr); quotedzputs(*ptr, xtrerr);
fputc(' ', xtrerr);
}
fprintf(xtrerr, ") "); fprintf(xtrerr, ") ");
} }
assignaparam(name, arr, WC_ASSIGN_TYPE2(ac) == WC_ASSIGN_INC); 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)) { for (lptr = firstnode(args); lptr; incnode(lptr)) {
if (lptr != firstnode(args)) if (lptr != firstnode(args))
fputc(' ', xtrerr); fputc(' ', xtrerr);
fprintf(xtrerr, "%s", (char *)getdata(lptr)); quotedzputs((char *)getdata(lptr), xtrerr);
} }
fputc('\n', xtrerr); fputc('\n', xtrerr);
fflush(xtrerr); fflush(xtrerr);