summaryrefslogtreecommitdiffstats
path: root/src/b_echo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/b_echo.c')
-rw-r--r--src/b_echo.c26
1 files 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");