diff --git a/42sh/src/exec/exec_case_branch.c b/42sh/src/exec/exec_case_branch.c index 9a618168..a705fad8 100644 --- a/42sh/src/exec/exec_case_branch.c +++ b/42sh/src/exec/exec_case_branch.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 20:33:45 by wescande #+# #+# */ -/* Updated: 2017/03/20 15:42:17 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 22:06:11 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,10 +23,11 @@ int exec_case_branch(t_btree **ast) return (0); node = (*ast)->item; av = token_to_argv(node->data.cmd.token, 1); - if (ft_strcmp(av[0], ((char **)exec->case_pattern)[0]) == 0) + if (av && (ft_strcmp(av[0], ((char **)exec->case_pattern)[0]) == 0)) { exec->attrs |= EXEC_CASE_BRANCH; ft_exec(&(*ast)->right); } + ft_tabdel(&av); return (0); } diff --git a/42sh/src/exec/plaunch_case.c b/42sh/src/exec/plaunch_case.c index 85806831..7c23b356 100644 --- a/42sh/src/exec/plaunch_case.c +++ b/42sh/src/exec/plaunch_case.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 19:02:23 by wescande #+# #+# */ -/* Updated: 2017/03/20 18:15:17 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 22:00:16 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,6 +19,7 @@ int plaunch_case(t_process *p) exec = &data_singleton()->exec; exec->attrs &= ~EXEC_CASE_BRANCH; exec->case_pattern = token_to_argv(p->data.d_case.token, 1); - ft_exec(&p->data.d_if.content); + ft_exec(&p->data.d_case.content); + ft_tabdel(&exec->case_pattern); return (0); } diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 8fddad30..7996a840 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */ -/* Updated: 2017/03/22 19:37:21 by jhalford ### ########.fr */ +/* Updated: 2017/03/22 22:02:30 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/produce_sym.c b/42sh/src/parser/produce_sym.c index b2e3f4c8..661940b5 100644 --- a/42sh/src/parser/produce_sym.c +++ b/42sh/src/parser/produce_sym.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 17:58:34 by ariard #+# #+# */ -/* Updated: 2017/03/22 19:26:03 by ariard ### ########.fr */ +/* Updated: 2017/03/22 21:51:30 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,6 +32,7 @@ t_prodmatch g_prodmatch[] = {TK_WORD, TK_PIPE, CMD_NAME}, {TK_WORD, AND_OR, CMD_NAME}, {TK_WORD, AND_OR_MAJOR, CMD_NAME}, + {TK_WORD, TK_PAREN_CLOSE, CMD_NAME}, {TK_WORD, TK_WHILE, CMD_NAME}, {TK_WORD, TK_UNTIL, CMD_NAME}, {TK_WORD, TK_DO, CMD_NAME},