diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-04-28 16:57:00 +0200 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-04-28 16:57:00 +0200 |
commit | eff60d9944bd58f10b5d0ea398752afa836f9098 (patch) | |
tree | 0327fcd7301b6470869bf3bd09b378ecf252b18c /src/ft_m_loop.c | |
parent | ladies and gentlement (diff) | |
download | 42-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.c | 6 |
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); |