diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_echo.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/ft_echo.c b/src/ft_echo.c index a7e6303..66d803f 100644 --- a/src/ft_echo.c +++ b/src/ft_echo.c @@ -1,5 +1,32 @@ #include <libft.h> -void -ft_echo(const char *arg) +#include <minishell.h> +#include <inttypes.h> + +int +ft_echo(char **com, uint8_t n) { + uint8_t i; + int fd; + + i = 1; + fd = 1; + if (!com[1]) + ft_putendl_fd("", fd); + else if (ft_strncmp(com[1], "-n", ft_strlen(com[1]))) + { + while (i < n) + { + ft_putendl_fd(com[i], fd); + i++; + } + } + else + { + while (i < n) + { + ft_putstr_fd(com[i], fd); + i++; + } + } + return (0); } |