case good close #212 #208

This commit is contained in:
Antoine Riard 2017-03-27 15:10:57 +02:00
parent f3aa0ec096
commit 1d4aff4746
3 changed files with 5 additions and 6 deletions

View file

@ -6,14 +6,14 @@
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ # # By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2016/08/29 21:32:58 by wescande #+# #+# # # Created: 2016/08/29 21:32:58 by wescande #+# #+# #
# Updated: 2017/03/27 03:12:30 by ariard ### ########.fr # # Updated: 2017/03/27 15:09:22 by ariard ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
NAME = 42sh NAME = 42sh
CC = gcc CC = gcc
FLAGS = -Wall -Wextra -Werror #-fsanitize=address FLAGS = -Wall -Wextra -Werror -fsanitize=address
D_FLAGS = -g D_FLAGS = -g
DELTA = $$(echo "$$(tput cols)-47"|bc) DELTA = $$(echo "$$(tput cols)-47"|bc)

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/22 22:10:26 by ariard ### ########.fr */ /* Updated: 2017/03/27 15:05:49 by ariard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -26,6 +26,7 @@ int exec_case_branch(t_btree **ast)
if (av && (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_tabdel(&exec->case_pattern);
ft_exec(&(*ast)->right); ft_exec(&(*ast)->right);
} }
ft_tabdel(&av); ft_tabdel(&av);

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/27 03:47:36 by ariard ### ########.fr */ /* Updated: 2017/03/27 15:06:42 by ariard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,8 +18,6 @@ int plaunch_case(t_process *p)
exec = &data_singleton()->exec; exec = &data_singleton()->exec;
exec->attrs &= ~EXEC_CASE_BRANCH; exec->attrs &= ~EXEC_CASE_BRANCH;
if (exec->case_pattern && *exec->case_pattern)
ft_tabdel(&exec->case_pattern);
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_case.content); ft_exec(&p->data.d_case.content);
ft_tabdel(&exec->case_pattern); ft_tabdel(&exec->case_pattern);