Merge branch 'master' of github.com:jzck/42sh

This commit is contained in:
wescande 2017-03-22 22:27:05 +01:00
commit cd5fefa671
4 changed files with 9 additions and 6 deletions

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */ /* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 20:33:45 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); return (0);
node = (*ast)->item; node = (*ast)->item;
av = token_to_argv(node->data.cmd.token, 1); 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; exec->attrs |= EXEC_CASE_BRANCH;
ft_exec(&(*ast)->right); ft_exec(&(*ast)->right);
} }
ft_tabdel(&av);
return (0); return (0);
} }

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */ /* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 19:02:23 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 = &data_singleton()->exec;
exec->attrs &= ~EXEC_CASE_BRANCH; exec->attrs &= ~EXEC_CASE_BRANCH;
exec->case_pattern = token_to_argv(p->data.d_case.token, 1); 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); return (0);
} }

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/20 14:45:40 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 17:58:34 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, TK_PIPE, CMD_NAME},
{TK_WORD, AND_OR, CMD_NAME}, {TK_WORD, AND_OR, CMD_NAME},
{TK_WORD, AND_OR_MAJOR, 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_WHILE, CMD_NAME},
{TK_WORD, TK_UNTIL, CMD_NAME}, {TK_WORD, TK_UNTIL, CMD_NAME},
{TK_WORD, TK_DO, CMD_NAME}, {TK_WORD, TK_DO, CMD_NAME},