From 33e9550f7ad34bd67e0989b5da6da2bf0a5671c0 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 30 Sep 2020 17:20:35 +0200 Subject: Normed b_echo --- src/b_echo.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/b_echo.c b/src/b_echo.c index b3d4953..f931f36 100644 --- a/src/b_echo.c +++ b/src/b_echo.c @@ -18,8 +18,18 @@ #include "s_struct.h" #include "u_utils.h" -uint8_t - b_echo(char *args[], t_msh *msh) +static void b_print_content(char *ptr[]) +{ + ft_printf("%s", *ptr); + ptr++; + while (*ptr != NULL) + { + ft_printf(" %s", *ptr); + ptr++; + } +} + +uint8_t b_echo(char *args[], t_msh *msh) { const uint64_t argc = u_builtins_get_argc((const char **)args); char **ptr; @@ -36,15 +46,9 @@ uint8_t ptr += 1; } if (argc - nopt >= 1) - { - ft_printf("%s", *ptr); - ptr++; - while (*ptr) - { - ft_printf(" %s", *ptr); - ptr++; - } - } + { + b_print_content(ptr); + } } if (nopt == 0) ft_printf("\n"); -- cgit v1.2.3