From a55f16b240a61dbea25f678166d0b9e98e8d78a3 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 21 Apr 2020 17:56:16 +0200 Subject: Messy echo --- src/ft_b_echo.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/ft_b_echo.c') 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 #include #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); } -- cgit v1.2.3