From b265e8475a01ba196db5c5259cf1395cd5ff9fc3 Mon Sep 17 00:00:00 2001 From: LuckyLaszlo Date: Mon, 29 Nov 2021 12:44:46 +0100 Subject: [PATCH] free_exit() renamed exit_free() --- headers/minishell_prototypes.h | 4 ++-- srcs/builtins/exit.c | 4 ++-- srcs/exec/pipeline.c | 4 ++-- srcs/exec/subshell_exec.c | 4 ++-- srcs/free.c | 4 ++-- srcs/main.c | 4 ++-- srcs/shell_loop.c | 4 ++-- srcs/shell_script.c | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/headers/minishell_prototypes.h b/headers/minishell_prototypes.h index 176dc2f..edd3a3b 100644 --- a/headers/minishell_prototypes.h +++ b/headers/minishell_prototypes.h @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */ -/* Updated: 2021/11/29 12:25:28 by lperrey ### ########.fr */ +/* Updated: 2021/11/29 12:43:15 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -65,7 +65,7 @@ int builtin_echo(int argc, char *argv[], t_all *c); int getenv_position(char **envp, char *name); // Free -int free_exit(t_all *c, int exit_status); +int exit_free(t_all *c, int exit_status); void free_pipeline(t_cmd **pipeline_ptr[]); void close_pipeline_fd(t_cmd *pipeline[]); typedef void (*t_free_f)(void *); // generic diff --git a/srcs/builtins/exit.c b/srcs/builtins/exit.c index 2a3e66f..7a726ea 100644 --- a/srcs/builtins/exit.c +++ b/srcs/builtins/exit.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/10 05:01:22 by lperrey #+# #+# */ -/* Updated: 2021/11/27 10:47:32 by lperrey ### ########.fr */ +/* Updated: 2021/11/29 12:43:47 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -38,5 +38,5 @@ int builtin_exit(int argc, char *argv[], t_all *c) // WIP } status = ft_atoi(argv[1]); } - return (free_exit(c, status)); + return (exit_free(c, status)); } diff --git a/srcs/exec/pipeline.c b/srcs/exec/pipeline.c index d6686fe..486a78f 100644 --- a/srcs/exec/pipeline.c +++ b/srcs/exec/pipeline.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */ -/* Updated: 2021/11/29 12:26:27 by lperrey ### ########.fr */ +/* Updated: 2021/11/29 12:43:52 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -83,7 +83,7 @@ static pid_t pipeline_exec(t_cmd *pipeline[], t_all *c) { ret = cmd_exec_in_subshell(pipeline[i], c); if (ret != EXIT_SUCCESS) - free_exit(c, ret); + exit_free(c, ret); } i++; } diff --git a/srcs/exec/subshell_exec.c b/srcs/exec/subshell_exec.c index 2503128..3b660e3 100644 --- a/srcs/exec/subshell_exec.c +++ b/srcs/exec/subshell_exec.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */ -/* Updated: 2021/11/29 12:26:33 by lperrey ### ########.fr */ +/* Updated: 2021/11/29 12:43:55 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -29,7 +29,7 @@ int cmd_exec_in_subshell(t_cmd *cmd, t_all *c) return (ft_reti_perror(EXIT_FAILURE, "dup2()")); close_pipeline_fd(c->pipeline); if (cmd->builtin_func) - free_exit(c, cmd->builtin_func(ft_2d_arrlen(cmd->argv), cmd->argv, c)); + exit_free(c, cmd->builtin_func(ft_2d_arrlen(cmd->argv), cmd->argv, c)); else if (execve(cmd->path, cmd->argv, environ) == -1) return (ft_reti_perror_io(EXIT_FAILURE, "execve() ", cmd->argv[0])); } diff --git a/srcs/free.c b/srcs/free.c index 7c8000f..d21ffc5 100644 --- a/srcs/free.c +++ b/srcs/free.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/10 23:53:17 by lperrey #+# #+# */ -/* Updated: 2021/11/29 12:25:46 by lperrey ### ########.fr */ +/* Updated: 2021/11/29 12:43:29 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -31,7 +31,7 @@ void ft_free_2d_arr_ENVIRON(void *ptr) free(arr); } -int free_exit(t_all *c, int exit_status) +int exit_free(t_all *c, int exit_status) { free(c->prompt_base); free(c->prompt); diff --git a/srcs/main.c b/srcs/main.c index c37b540..e28ea1c 100644 --- a/srcs/main.c +++ b/srcs/main.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/04 05:59:26 by lperrey #+# #+# */ -/* Updated: 2021/11/27 11:19:15 by lperrey ### ########.fr */ +/* Updated: 2021/11/29 12:43:34 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) (void)argc; (void)argv; if (!init(&c)) - free_exit(&c, EXIT_FAILURE); + exit_free(&c, EXIT_FAILURE); //putenv("VAR=W1 W2 W3"); // TEMP TEST // if (argv[1] || !isatty(STDIN_FILENO)) // shell_script(&c); diff --git a/srcs/shell_loop.c b/srcs/shell_loop.c index 9a5a214..dfeae6b 100644 --- a/srcs/shell_loop.c +++ b/srcs/shell_loop.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/04 05:59:26 by lperrey #+# #+# */ -/* Updated: 2021/11/29 12:25:59 by lperrey ### ########.fr */ +/* Updated: 2021/11/29 12:43:38 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -46,7 +46,7 @@ void shell_loop(t_all *c) else if (!line_input) { write(1, "exit\n", 5); - free_exit(c, get_last_exit_status()); + exit_free(c, get_last_exit_status()); } } } diff --git a/srcs/shell_script.c b/srcs/shell_script.c index 017d4aa..7790cfb 100644 --- a/srcs/shell_script.c +++ b/srcs/shell_script.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/26 23:47:44 by lperrey #+# #+# */ -/* Updated: 2021/10/30 15:01:13 by lperrey ### ########.fr */ +/* Updated: 2021/11/29 12:43:44 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,5 +15,5 @@ void shell_script(t_all *c) // WIP { ft_putstr_fd("Shell Script Placeholder\n", 1); - free_exit(c, EXIT_SUCCESS); + exit_free(c, EXIT_SUCCESS); }