From 079d839aee68e52932eacbd8d4c75ba1388b006a Mon Sep 17 00:00:00 2001
From: Rudy Bousset <rbousset@z2r5p6.le-101.fr>
Date: Tue, 29 Oct 2019 13:22:04 +0100
Subject: tons of changes

---
 src/ft_echo.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

(limited to 'src/ft_echo.c')

diff --git a/src/ft_echo.c b/src/ft_echo.c
index a7e6303..66d803f 100644
--- a/src/ft_echo.c
+++ b/src/ft_echo.c
@@ -1,5 +1,32 @@
 #include <libft.h>
-void
-ft_echo(const char *arg)
+#include <minishell.h>
+#include <inttypes.h>
+
+int
+ft_echo(char **com, uint8_t n)
 {
+	uint8_t i;
+	int fd;
+
+	i = 1;
+	fd = 1;
+	if (!com[1])
+		ft_putendl_fd("", fd);
+	else if (ft_strncmp(com[1], "-n", ft_strlen(com[1])))
+	{
+		while (i < n)
+		{
+			ft_putendl_fd(com[i], fd);
+			i++;
+		}
+	}
+	else
+	{
+		while (i < n)
+		{
+			ft_putstr_fd(com[i], fd);
+			i++;
+		}
+	}
+	return (0);
 }
-- 
cgit v1.2.3