From 827010aaef44058822467c3b3b1db50013fec33d Mon Sep 17 00:00:00 2001 From: salad Date: Mon, 27 Apr 2020 15:39:25 +0200 Subject: dirty dirty work --- src/ft_b_echo.c | 11 ++++++++--- src/minishell.c | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ft_b_echo.c b/src/ft_b_echo.c index fdac868..c849924 100644 --- a/src/ft_b_echo.c +++ b/src/ft_b_echo.c @@ -12,6 +12,7 @@ #include #include +#include #include "ft_s_struct.h" #include "ft_u_utils.h" @@ -27,11 +28,13 @@ uint8_t { const uint64_t argc = ft_get_argc((const char **)args); char **ptr; + char *str; int8_t nopt; (void)msh; ptr = args; nopt = 0; + str = malloc(1000); if (argc >= 1) { if (ft_strncmp(ptr[0], "-n", 2) == 0) @@ -41,15 +44,17 @@ uint8_t } if (argc - nopt >= 1) { - ft_printf("%s", *ptr); - ptr++; + ft_sprintf(str, "%s", *ptr); + ptr++; while (*ptr) { - ft_printf(" %s", *ptr); + ft_sprintf(str + ft_strlen(str), " %s", *ptr); ptr++; } } } + str = ft_strtrim(str, "\"\'"); + ft_putstr(str); if (nopt == 0) ft_printf("\n"); return (0); diff --git a/src/minishell.c b/src/minishell.c index f5216a8..e9f9c3f 100644 --- a/src/minishell.c +++ b/src/minishell.c @@ -12,6 +12,7 @@ #include #include +#include #include #include -- cgit v1.2.3