-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexecutor.c
33 lines (31 loc) · 1.58 KB
/
executor.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* executor.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asabani <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/01 16:12:41 by asabani #+# #+# */
/* Updated: 2022/03/03 00:45:43 by asabani ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void executor(t_cmdtree *tree)
{
if (!tree)
return ;
if (tree->node_type == NODE_CMDLST)
return (run_cmdlist((t_cmdlist *)tree));
else if (tree->node_type == NODE_PIPE)
return (run_pipeline((t_connector *)tree));
else if (tree->node_type == NODE_AND || tree->node_type == NODE_OR)
return (run_logical_connector((t_connector *)tree, tree->node_type));
else if (tree->node_type == NODE_SUBSH)
return (run_subshell((t_subsh *)tree));
else if (tree->node_type == NODE_FG)
return (run_fg_connector((t_connector *)tree));
else if (tree->node_type == NODE_BG)
return (run_bg_connector((t_connector *)tree));
else if (tree->node_type == NODE_REDIR)
run_redirection((t_redir *)tree, 1);
}