Compare commits
2 Commits
6ce54ea6fe
...
7ea602b12c
Author | SHA1 | Date | |
---|---|---|---|
|
7ea602b12c | ||
|
7ffe556cd4 |
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user