From 7e3b7d9c3a0a4f4f0e03b3ade0b2b69fdc7804be Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 3 Sep 2020 19:37:37 +0200 Subject: =?UTF-8?q?On=20est=20sur=20un=20probl=C3=A8me?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/p_args_quotes.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/p_args_quotes.c b/src/p_args_quotes.c index 2b47b6b..3290a01 100644 --- a/src/p_args_quotes.c +++ b/src/p_args_quotes.c @@ -18,13 +18,29 @@ static void p_arg_squotes(char word[]) { - ft_memmove(word, word + 1, ft_strlen(word)); + char *ptr; + + ptr = word; + while ((ptr = ft_strchr(ptr, C_SQUOTE)) != NULL) + { + ft_memmove(word + (ptr - word), ptr + 1, ft_strlen(ptr + 1) + 1); + } } static void p_arg_dquotes(char word[]) { - (void)word; + char *ptr; + + ft_memmove(word, word + 1, ft_strlen(word)); + ptr = word; + while ((ptr = ft_strchr(ptr, C_DQUOTE)) != NULL) + { + if (*(ptr - 1) == C_BACKSLASH && *(ptr - 2) != C_BACKSLASH) + ptr++; + else + ft_memmove(word + (ptr - word), ptr + 1, ft_strlen(ptr + 1) + 1); + } } void -- cgit v1.2.3