summaryrefslogtreecommitdiffstats
path: root/src/ft_m_loop.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-04-28 16:57:00 +0200
committersalad <fmoenne-@student.le-101.fr>2020-04-28 16:57:00 +0200
commiteff60d9944bd58f10b5d0ea398752afa836f9098 (patch)
tree0327fcd7301b6470869bf3bd09b378ecf252b18c /src/ft_m_loop.c
parentladies and gentlement (diff)
download42-minishell-eff60d9944bd58f10b5d0ea398752afa836f9098.tar.gz
42-minishell-eff60d9944bd58f10b5d0ea398752afa836f9098.tar.bz2
42-minishell-eff60d9944bd58f10b5d0ea398752afa836f9098.tar.xz
42-minishell-eff60d9944bd58f10b5d0ea398752afa836f9098.tar.zst
42-minishell-eff60d9944bd58f10b5d0ea398752afa836f9098.zip
sneaky segv, onto backslashes
Diffstat (limited to '')
-rw-r--r--src/ft_m_loop.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ft_m_loop.c b/src/ft_m_loop.c
index 8302bfc..6a05dd6 100644
--- a/src/ft_m_loop.c
+++ b/src/ft_m_loop.c
@@ -32,13 +32,13 @@ uint8_t
ft_memcpy(prog, line, (quote - line));
buf = ft_strdup(line + (quote - line) + 1);
gnl = 1;
- while (gnl > 0 && (!(quote = ft_strrchr(buf, '\"'))))
+ while (gnl > 0 && ((!(quote = ft_strrchr(buf, '\"'))) && (!(quote = ft_strrchr(buf, '\'')))))
{
ft_m_cont_prompt();
gnl = get_next_line(STDIN_FILENO, &line);
ft_sprintf(buf + ft_strlen(buf), "\n%s", line);
}
- buf = ft_strtrim(buf, "\"\'");
+ buf = ft_strtrim(buf, "\"'");
ft_p_line(ft_strjoin(prog, buf), msh);
ft_memdel((void*)&line);
ft_memdel((void*)&buf);
@@ -61,7 +61,7 @@ uint8_t
gnl = get_next_line(STDIN_FILENO, &line);
if (line[0] != '\0')
{
- if (!(quote = ft_strchr(line, '\"')))
+ if (!(quote = ft_strchr(line, '\'')) && !(quote = ft_strchr(line, '\"')))
{
ft_p_line(line, msh);
ft_memdel((void*)&line);