diff --git a/builtins/.echo.c.swp b/builtins/.echo.c.swp index 7361b42..7ed1b8e 100644 Binary files a/builtins/.echo.c.swp and b/builtins/.echo.c.swp differ diff --git a/builtins/echo.c b/builtins/echo.c index 32c495b..8a3800f 100644 --- a/builtins/echo.c +++ b/builtins/echo.c @@ -6,11 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/17 13:09:08 by erey-bet #+# #+# */ -<<<<<<< HEAD -/* Updated: 2023/02/21 21:45:38 by cchauvet ### ########.fr */ -======= -/* Updated: 2023/02/21 22:09:55 by erey-bet ### ########.fr */ ->>>>>>> 1fdc51a668e616de94c33d5b3b1e9cb51182916d +/* Updated: 2023/02/21 22:15:27 by cchauvet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -49,7 +45,6 @@ int check_argument(char *str, int *check, int i) return (i); } - char *conca(char **strs) { int len; @@ -60,7 +55,7 @@ char *conca(char **strs) i = -1; len = 0; while (strs[++i] != NULL) - len += strlen(strs[i]) + 2; + len += ft_strlen(strs[i]) + 2; str = (char *) ft_calloc(len + 1, sizeof(char)); if (str == NULL) return NULL; @@ -74,7 +69,6 @@ char *conca(char **strs) return (str); } - int echo(int fd, char **strs) { int check; diff --git a/cmd.c b/cmd.c index a3de42c..2609718 100644 --- a/cmd.c +++ b/cmd.c @@ -6,7 +6,7 @@ /* By: cchauvet args); if (content->executable != NULL) free(content->executable); - if (content->fd_in > 2) - close(content->fd_in); - if (content->fd_out > 2) - close(content->fd_in); free(content); } diff --git a/execution.c b/execution.c index 410f994..d833c55 100644 --- a/execution.c +++ b/execution.c @@ -6,12 +6,13 @@ /* By: cchauvet static char *ft_get_executable_path(char *executable_name, t_list **env) { @@ -158,6 +159,10 @@ int ft_cmds_executor(t_data *data, t_list **cmds) ft_eprintf("minishell: malloc failed\n"); return (1); } + if (content->fd_in > 2) + close(content->fd_in); + if (content->fd_out > 2) + close(content->fd_out); set_value_by_key("?", return_value, data->env); current = current->next; }