diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-03 19:37:37 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-03 19:37:37 +0200 |
commit | 7e3b7d9c3a0a4f4f0e03b3ade0b2b69fdc7804be (patch) | |
tree | 6729e05f9349ccb24eed01794f359ad1c4074536 /src | |
parent | am good (diff) | |
download | 42-minishell-7e3b7d9c3a0a4f4f0e03b3ade0b2b69fdc7804be.tar.gz 42-minishell-7e3b7d9c3a0a4f4f0e03b3ade0b2b69fdc7804be.tar.bz2 42-minishell-7e3b7d9c3a0a4f4f0e03b3ade0b2b69fdc7804be.tar.xz 42-minishell-7e3b7d9c3a0a4f4f0e03b3ade0b2b69fdc7804be.tar.zst 42-minishell-7e3b7d9c3a0a4f4f0e03b3ade0b2b69fdc7804be.zip |
On est sur un problème
Diffstat (limited to 'src')
-rw-r--r-- | src/p_args_quotes.c | 20 |
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 |