diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_b_echo.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/ft_b_echo.c b/src/ft_b_echo.c index 326967d..6a3af34 100644 --- a/src/ft_b_echo.c +++ b/src/ft_b_echo.c @@ -13,16 +13,31 @@ #include <libft.h> #include <stdint.h> #include "ft_s_struct.h" +#include "ft_u_utils.h" uint8_t ft_b_echo(char *args[], t_msh *msh) { + char **ptr; + int8_t nopt; + (void)msh; - while (*args) + ptr = args; + nopt = 0; + if (ft_strncmp(ptr[0], "-n", 2) == 0) + { + nopt = 1; + ptr += 1; + } + ft_printf("%s", *ptr); + ptr++; + while (*ptr) { - ft_printf("%s\n", *args); - args++; + ft_printf(" %s", *ptr); + ptr++; } + if (nopt == 0) + ft_printf("\n"); return (0); } |