From c72367efb5e2bf7b188215d336eb565649806401 Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Sun, 21 Jul 2024 12:59:53 +0200 Subject: [PATCH] Make some small changes --- src/execution.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/execution.c b/src/execution.c index 05c6e31..2b73dd9 100644 --- a/src/execution.c +++ b/src/execution.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/21 08:57:54 by ljiriste #+# #+# */ -/* Updated: 2024/07/21 12:56:41 by ljiriste ### ########.fr */ +/* Updated: 2024/07/21 13:02:19 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,11 +30,13 @@ int ex_simple_command(t_parse_tree_node *simple_command, t_execution_info *info) if (!*fields) { save_assignments(&assignments, info); + ex_redirections(&redirections); return (0); } - ex_fields(fields, assignments, redirections, info); + ex_fields(fields, &assignments, &redirections, info); ft_vec_free(&redirections, void_free_redirection); ft_vec_free(&assignments, void_free_assignments); + free_fields(fields); return (0); } @@ -47,7 +49,7 @@ int subshell(t_parse_tree_node *program, const t_execution_info *info) return (1); res = ex_program(program, &info_copy); info->ret_val = info_copy->ret_val; - free_info(info_copy); + free_info(&info_copy); return (res); } @@ -70,7 +72,7 @@ int ex_pipeline(t_parse_tree_node *pipeline, t_execution_info *info) { if (pipe(pipe_fds)) return (1); - ft_swap_fd(&pipe_fds[1], &info->stdout_fd); + ft_swap_int(&pipe_fds[1], &info->stdout_fd); ex_pipeline(ft_vec_access(&pipeline->children, 0), info); ft_swap_int(&pipe_fds[1], &info->stdout_fd); ft_swap_int(&pipe_fds[0], &info->stdin_fd); @@ -102,5 +104,9 @@ int ex_program(t_parse_tree_node *program, t_execution_info *info) int execute(t_tree *parse_tree, t_vars *vars) { - return (ex_program(parse_tree, env)); + t_execution_info info; + + construct_info(&info, vars); + return (ex_program(parse_tree, &info)); + free_info(&info); } -- 2.30.2