diff --git a/42sh/src/exec/plaunch_function.c b/42sh/src/exec/plaunch_function.c index 8b5da368..b3530d32 100644 --- a/42sh/src/exec/plaunch_function.c +++ b/42sh/src/exec/plaunch_function.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 03:23:59 by wescande #+# #+# */ -/* Updated: 2017/03/23 03:15:20 by ariard ### ########.fr */ +/* Updated: 2017/03/23 06:19:00 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,22 +18,23 @@ int plaunch_function(t_process *p) { static int protection= 0; + /* char *val; */ - if (ft_atoi(ft_getenv(data_singleton()->env, "FUNC_LVL")) > 10) - return(SH_ERR(FUNCERR_0)); + /* if (ft_atoi(ft_getenv(data_singleton()->env, "FUNC_LVL")) > FUNC_LVL) */ + /* return(SH_ERR(FUNCERR_0)); */ if (protection >= FUNC_LVL) return(SH_ERR(FUNCERR_0)); protection++; // jack faut qu on parle - builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL", - ft_itoa(ft_atoi(ft_getenv(data_singleton()->env, "FUNC_LVL")) + 1), - NULL}, NULL); + /* val = ft_itoa(ft_atoi(ft_getenv(data_singleton()->env, "FUNC_LVL")) + 1); */ + /* builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL", val, NULL}, NULL); */ + /* ft_strdel(&val); */ ft_exec(&p->data.function.content); - builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL", - ft_itoa(ft_atoi(ft_getenv(data_singleton()->env, "FUNC_LVL")) - 1), - NULL}, NULL); + /* val = ft_itoa(ft_atoi(ft_getenv(data_singleton()->env, "FUNC_LVL")) - 1); */ + /* builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL", val, NULL}, NULL); */ + /* ft_strdel(&val); */ protection--; return (ft_atoi(ft_getenv(data_singleton()->env, "?"))); } diff --git a/42sh/src/exec/pset_cmd.c b/42sh/src/exec/pset_cmd.c index 4d973664..2dc99f87 100644 --- a/42sh/src/exec/pset_cmd.c +++ b/42sh/src/exec/pset_cmd.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 12:41:54 by jhalford #+# #+# */ -/* Updated: 2017/03/21 21:10:58 by ariard ### ########.fr */ +/* Updated: 2017/03/23 06:29:11 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,6 +21,7 @@ int pset_cmd(t_process *p, t_btree *ast) return ((p->type = PROCESS_EMPTY) ? 0 : 0); if ((func = is_function(p))) { + ft_tabdel(&p->data.cmd.av); p->data.function.content = func; p->type = PROCESS_FUNCTION; } diff --git a/42sh/src/main/data_init.c b/42sh/src/main/data_init.c index 7921b68a..97ff9b29 100644 --- a/42sh/src/main/data_init.c +++ b/42sh/src/main/data_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */ -/* Updated: 2017/03/23 03:16:08 by ariard ### ########.fr */ +/* Updated: 2017/03/23 06:19:27 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -66,9 +66,9 @@ int data_init(int ac, char **av) data->lst_func = NULL; lexer_init(&data->lexer); parser_init(&data->parser); - if (!ft_getenv(data_singleton()->env, "FUNC_LVL")) - builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL", "-1", - NULL}, NULL); + /* if (!ft_getenv(data_singleton()->env, "FUNC_LVL")) */ + /* builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL", "-1", */ + /* NULL}, NULL); */ if ((term_name = ft_getenv(data->env, "TERM")) == NULL) { term_name = "dumb";