diff options
author | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2019-10-29 13:22:04 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2019-10-29 13:22:04 +0100 |
commit | 079d839aee68e52932eacbd8d4c75ba1388b006a (patch) | |
tree | 406665acdbfa9e61fbccad924d4dcc27de0463e1 /src/ft_echo.c | |
parent | libft included (diff) | |
download | 42-minishell-079d839aee68e52932eacbd8d4c75ba1388b006a.tar.gz 42-minishell-079d839aee68e52932eacbd8d4c75ba1388b006a.tar.bz2 42-minishell-079d839aee68e52932eacbd8d4c75ba1388b006a.tar.xz 42-minishell-079d839aee68e52932eacbd8d4c75ba1388b006a.tar.zst 42-minishell-079d839aee68e52932eacbd8d4c75ba1388b006a.zip |
tons of changes
Diffstat (limited to 'src/ft_echo.c')
-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); } |