summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-04-27 15:39:25 +0200
committersalad <fmoenne-@student.le-101.fr>2020-04-27 15:39:25 +0200
commit827010aaef44058822467c3b3b1db50013fec33d (patch)
tree38481af9233a8ce284fa83b134fbe7ef8e3e7a14 /src
parentRemoved debug printf (diff)
download42-minishell-827010aaef44058822467c3b3b1db50013fec33d.tar.gz
42-minishell-827010aaef44058822467c3b3b1db50013fec33d.tar.bz2
42-minishell-827010aaef44058822467c3b3b1db50013fec33d.tar.xz
42-minishell-827010aaef44058822467c3b3b1db50013fec33d.tar.zst
42-minishell-827010aaef44058822467c3b3b1db50013fec33d.zip
dirty dirty work
Diffstat (limited to 'src')
-rw-r--r--src/ft_b_echo.c11
-rw-r--r--src/minishell.c1
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>