summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/p_args_quotes.c20
1 files changed, 18 insertions, 2 deletions
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