4 char nl='\n'; /* change to semicolon for bourne-proofing */
10 pdeglob(io *f, char *s)
25 default: pfmt(f, "bad %d %p %p %p", t->type, c0, c1, c2);
27 case '$': pfmt(f, "$%t", c0);
29 case '"': pfmt(f, "$\"%t", c0);
31 case '&': pfmt(f, "%t&", c0);
33 case '^': pfmt(f, "%t^%t", c0, c1);
35 case '`': pfmt(f, "`%t%t", c0, c1);
37 case ANDAND: pfmt(f, "%t && %t", c0, c1);
39 case BANG: pfmt(f, "! %t", c0);
41 case BRACE: pfmt(f, "{%t}", c0);
43 case COUNT: pfmt(f, "$#%t", c0);
45 case FN: pfmt(f, "fn %t %t", c0, c1);
47 case IF: pfmt(f, "if%t%t", c0, c1);
49 case NOT: pfmt(f, "if not %t", c0);
51 case OROR: pfmt(f, "%t || %t", c0, c1);
54 case PAREN: pfmt(f, "(%t)", c0);
56 case SUB: pfmt(f, "$%t(%t)", c0, c1);
58 case SIMPLE: pfmt(f, "%t", c0);
60 case SUBSHELL: pfmt(f, "@ %t", c0);
62 case SWITCH: pfmt(f, "switch %t %t", c0, c1);
64 case TWIDDLE: pfmt(f, "~ %t %t", c0, c1);
66 case WHILE: pfmt(f, "while %t%t", c0, c1);
74 pfmt(f, "%t %t", c0, c1);
79 pfmt(f, "%t%c%t", c0, nl, c1);
80 else pfmt(f, "%t", c0);
82 else pfmt(f, "%t", c1);
90 pfmt(f, "for(%t", c0);
92 pfmt(f, " in %t", c1);
97 pfmt(f, "%Q", t->str);
98 else pdeglob(f, t->str);
102 pfmt(f, ">[%d=%d]", t->fd1, t->fd0); /* yes, fd1, then fd0; read lex.c */
104 pfmt(f, ">[%d=]", t->fd0);
118 pfmt(f, "[%d]", t->fd0);
125 pfmt(f, "[%d]", t->fd0);
133 pfmt(f, "%t=%t", c0, c1);
141 pfmt(f, "[%d]", t->fd0);
143 else pfmt(f, "[%d=%d]", t->fd0, t->fd1);