diff options
-rw-r--r-- | src/ft_b_echo.c | 11 | ||||
-rw-r--r-- | src/minishell.c | 1 |
2 files changed, 9 insertions, 3 deletions
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 <libft.h> #include <stdint.h> +#include <stdlib.h> #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 <libft.h> #include <stdint.h> +#include <unistd.h> #include <string.h> #include <errno.h> |