7 * create and clear a new tree node, and add it
17 t->child[0] = t->child[1] = t->child[2] = 0;
27 for(t = treenodes;t;t = u){
37 tree1(int type, tree *c0)
39 return tree3(type, c0, (tree *)0, (tree *)0);
43 tree2(int type, tree *c0, tree *c1)
45 return tree3(type, c0, c1, (tree *)0);
49 tree3(int type, tree *c0, tree *c1, tree *c2)
67 mung1(tree *t, tree *c0)
74 mung2(tree *t, tree *c0, tree *c1)
82 mung3(tree *t, tree *c0, tree *c1, tree *c2)
91 epimung(tree *comp, tree *epi)
96 for(p = epi;p->child[1];p = p->child[1]);
101 * Add a SIMPLE node at the root of t and percolate all the redirections
111 t = tree1(SIMPLE, t);
114 t->str = strdup((char *)s->strp);
116 for(u = t->child[0];u->type==ARGLIST;u = u->child[0]){
117 if(u->child[1]->type==DUP
118 || u->child[1]->type==REDIR){
119 u->child[1]->child[1] = t;
128 token(char *str, int type)
133 t->str = strdup(str);
142 freetree(p->child[0]);
143 freetree(p->child[1]);
144 freetree(p->child[2]);