Compare commits

..

2 Commits

Author SHA1 Message Date
Etienne Rey-bethbeder
7ea602b12c Merge branch 'master' of https://git.chauvet.pro/starnakin/minishell 2023-03-13 16:31:06 +01:00
Etienne Rey-bethbeder
7ffe556cd4 CORINNE J'AI CHAUD, VIENS 42 2023-03-13 16:30:45 +01:00

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/17 13:09:08 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); return (1);
if (ft_strnstr(str, "n", ft_strlen(str))) if (ft_strnstr(str, "n", ft_strlen(str)))
*check = 1; *check = 1;
else
return (1);
return (0); return (0);
} }
@ -42,8 +44,9 @@ int echo(int fd, char **strs)
{ {
while (is_space(*strs[i])) while (is_space(*strs[i]))
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); ft_putstr_fd(strs[i], fd);
if (strs[i + 1] != NULL) if (strs[i + 1] != NULL)
write(fd, " ", 1); write(fd, " ", 1);