summaryrefslogtreecommitdiffstats
path: root/src/p_args_escape.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-06 18:46:43 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-06 18:46:43 +0200
commit5c08ce82d29f8484ea477f8bb709ac358789c9bb (patch)
tree8e1beb47dc96febb873dd20033e1743479ba3108 /src/p_args_escape.c
parentUpdate (diff)
download42-minishell-5c08ce82d29f8484ea477f8bb709ac358789c9bb.tar.gz
42-minishell-5c08ce82d29f8484ea477f8bb709ac358789c9bb.tar.bz2
42-minishell-5c08ce82d29f8484ea477f8bb709ac358789c9bb.tar.xz
42-minishell-5c08ce82d29f8484ea477f8bb709ac358789c9bb.tar.zst
42-minishell-5c08ce82d29f8484ea477f8bb709ac358789c9bb.zip
Commit from minishell
Diffstat (limited to '')
-rw-r--r--src/p_args_escape.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/p_args_escape.c b/src/p_args_escape.c
index ed319a1..abdf3b3 100644
--- a/src/p_args_escape.c
+++ b/src/p_args_escape.c
@@ -71,13 +71,12 @@ static t_quote_mode
}
static void
- p_escape_bs(char *ptr, char **p, char word[], t_quote_mode mode)
+ p_escape_bs(char *ptr, char word[], t_quote_mode mode)
{
if (mode == Q_NONE)
{
(void)ft_memmove(word + (ptr - word), ptr + 1,
(ft_strlen(ptr + 1) + 1) * sizeof(char));
- *(p) -= 1;
}
else if (mode == Q_DOUBLE)
{
@@ -85,13 +84,11 @@ static void
{
(void)ft_memmove(word + (ptr - word), ptr + 1,
(ft_strlen(ptr + 1) + 1) * sizeof(char));
- *(p) -= 1;
}
else if (*(ptr + 1) == C_DQUOTE)
{
(void)ft_memmove(word + (ptr - word), ptr + 1,
(ft_strlen(ptr + 1) + 1) * sizeof(char));
- *(p) -= 1;
}
}
}
@@ -108,10 +105,10 @@ static void
{
if (*ptr == C_SQUOTE)
mode = p_escape_squote(ptr, &ptr, word, mode);
- if (*ptr == C_DQUOTE)
+ else if (*ptr == C_DQUOTE)
mode = p_escape_dquote(ptr, &ptr, word, mode);
- if (*ptr == C_BACKS)
- p_escape_bs(ptr, &ptr, word, mode);
+ else if (*ptr == C_BACKS)
+ p_escape_bs(ptr, word, mode);
ptr++;
}
}