/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/21 21:24:52 by ljiriste #+# #+# */
-/* Updated: 2024/07/21 23:46:03 by ljiriste ### ########.fr */
+/* Updated: 2024/08/02 10:46:15 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
env->stdin_fd = STDIN_FILENO;
env->stdout_fd = STDOUT_FILENO;
env->ret_val = 0;
- if (ft_vec_init(&env->redirections, sizeof(t_redirection)))
- return (1);
env->vars = malloc(sizeof(t_vars));
if (!env->vars)
- {
- ft_vec_free(&env->redirections, NULL);
return (1);
- }
return (init_vars(env->vars, envp));
}
{
clean_vars(env->vars);
free(env->vars);
- ft_vec_free(&env->redirections, NULL);
return ;
}
/* By: ljiriste <ljiriste@student.42prague.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/21 08:57:54 by ljiriste #+# #+# */
-/* Updated: 2024/08/01 15:30:29 by ljiriste ### ########.fr */
+/* Updated: 2024/08/01 15:43:00 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
ft_vec_init(©->vars->other, sizeof(char *));
ft_vec_copy(©->vars->exported, &env->vars->exported, v_strcopy, free);
ft_vec_copy(©->vars->other, &env->vars->other, v_strcopy, free);
- ft_vec_copy(©->redirections, &env->redirections, v_copy_redir, NULL);
return (0);
}
{
clean_vars(env->vars);
free(env->vars);
- ft_vec_free(&env->redirections, NULL);
return ;
}
int res;
res = ex_program(parse_tree, env);
- ft_vec_forget_range(&env->redirections, env->redirections.size, 0);
return (res);
}