/* ** exec_node.c for 42sh in /home/seblu ** ** Made by Seblu ** Login ** ** Started on Sat Mar 25 14:51:09 2006 Seblu ** Last update Sat Apr 15 09:12:38 2006 Seblu */ #include "execution.h" #include "mem.h" /*! ** Execute a node of ast by calling the good function ** ** @param node node to execute ** @param sh shell struct */ void exec_node(struct s_ast *node, struct s_42sh *sh) { assert(sh); if (node == NULL) return; else if (node->type == T_CMD) exec_cmd(&node->data.node_cmd, sh); else if (node->type == T_PIPE) exec_pipe(&node->data.node_op, sh); else if (node->type == T_LINE) exec_line(&node->data.node_op, sh); else if (node->type == T_SEP_AND) exec_sepand(&node->data.node_op, sh); else if (node->type == T_SEP_SEMICOMMA) exec_sepsemicolon(&node->data.node_op, sh); else if (node->type == T_IF) exec_if(&node->data.node_if, sh); else if (node->type == T_FOR) exec_for(&node->data.node_for, sh); else if (node->type == T_AND) exec_and(&node->data.node_op, sh); else if (node->type == T_OR) exec_or(&node->data.node_op, sh); else if (node->type == T_WHILE) exec_while(&node->data.node_while, sh); else if (node->type == T_UNTIL) exec_until(&node->data.node_while, sh); else if (node->type == T_BANG) exec_bang(&node->data.node_op, sh); else if (node->type == T_SUBSHELL) exec_subshell(&node->data.node_subshell, sh); else assert(0); }