#include "rc.h"
#include "exec.h"
#include "io.h"
#include "fns.h"
tree *treenodes;
/*
* create and clear a new tree node, and add it
* to the node list.
*/
tree*
mung2(tree *t, tree *c0, tree *c1)
{
t->child[0] = c0;
t->child[1] = c1;
return t;
}
tree*
mung3(tree *t, tree *c0, tree *c1, tree *c2)
{
t->child[0] = c0;
t->child[1] = c1;
t->child[2] = c2;
return t;
}
tree*
epimung(tree *comp, tree *epi)
{
tree *p;
if(epi==0)
return comp;
for(p = epi;p->child[1];p = p->child[1]);
p->child[1] = comp;
return epi;
}
/*
* Add a SIMPLE node at the root of t and percolate all the redirections
* up to the root.
*/
tree*
simplemung(tree *t)
{
tree *u;
struct io *s;