summaryrefslogtreecommitdiffstats
path: root/src
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
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 'src')
-rw-r--r--src/p_args.c28
-rw-r--r--src/p_args_escape.c11
2 files changed, 18 insertions, 21 deletions
diff --git a/src/p_args.c b/src/p_args.c
index 79f66bd..ae92523 100644
--- a/src/p_args.c
+++ b/src/p_args.c
@@ -24,18 +24,18 @@
/* TODO: DELETE THIS */
/* ================= */
-static void
-p_print(char *words[])
-{
- char **ptr;
-
- ptr = words;
- while (*ptr != NULL)
- {
- ft_printf("[%s]\n", *ptr);
- ptr++;
- }
-}
+/* static void */
+/* p_print(char *words[]) */
+/* { */
+/* char **ptr; */
+
+/* ptr = words; */
+/* while (*ptr != NULL) */
+/* { */
+/* ft_printf("[%s]\n", *ptr); */
+/* ptr++; */
+/* } */
+/* } */
/* ================== */
/* TODO: DELETE ABOVE */
@@ -166,8 +166,8 @@ static char
return (NULL);
}
p_args_escape_chars_and_quotes(words);
- p_print(words);
- exit(0);
+ /* p_print(words); */
+ /* exit(0); */
return (words);
}
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++;
}
}