diff --git a/builtins/echo.c b/builtins/echo.c index ddd3d0d..730d879 100644 --- a/builtins/echo.c +++ b/builtins/echo.c @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/17 13:09:08 by erey-bet #+# #+# */ -/* Updated: 2023/02/22 13:23:16 by erey-bet ### ########.fr */ +/* Updated: 2023/03/13 16:29:47 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -28,6 +28,8 @@ int check_argument(char *str, int *check) return (1); if (ft_strnstr(str, "n", ft_strlen(str))) *check = 1; + else + return (1); return (0); } @@ -42,8 +44,9 @@ int echo(int fd, char **strs) { while (is_space(*strs[i])) strs[i]++; - if (check == 1 || check_argument(strs[i], &check)) + if (check == 2 || check_argument(strs[i], &check)) { + check = 2; ft_putstr_fd(strs[i], fd); if (strs[i + 1] != NULL) write(fd, " ", 1);