diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-28 14:46:35 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-28 14:46:35 +0200 |
commit | 6f4b096ba1cff30c1c33dd887aa70740be7990c7 (patch) | |
tree | 893c469057e07bd64482af7d3055797dbea1703d /src/m_loop_next.c | |
parent | Quick tabs fix (diff) | |
download | 42-minishell-6f4b096ba1cff30c1c33dd887aa70740be7990c7.tar.gz 42-minishell-6f4b096ba1cff30c1c33dd887aa70740be7990c7.tar.bz2 42-minishell-6f4b096ba1cff30c1c33dd887aa70740be7990c7.tar.xz 42-minishell-6f4b096ba1cff30c1c33dd887aa70740be7990c7.tar.zst 42-minishell-6f4b096ba1cff30c1c33dd887aa70740be7990c7.zip |
Multiline added for &&
Diffstat (limited to '')
-rw-r--r-- | src/m_loop_next.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/m_loop_next.c b/src/m_loop_next.c index 9aa7129..1a8d867 100644 --- a/src/m_loop_next.c +++ b/src/m_loop_next.c @@ -60,7 +60,7 @@ static char } char - *m_check_multi_backslash(int32_t fd, char *line, t_msh *msh) + *m_check_multi_backslash(int32_t fd, char line[], t_msh *msh) { if (line[ft_strlen(line) - 1] == '\\') { @@ -71,13 +71,13 @@ char } char - *m_check_multi_pipe(int32_t fd, char *line, t_msh *msh) + *m_check_multi_pipe(int32_t fd, char line[], t_msh *msh) { char *pipe; if ((pipe = ft_strrchr(line, '|')) != NULL) { - pipe++; + pipe += 1; while (*pipe != '\0') { if (ft_isspace(*pipe) == FALSE) @@ -93,3 +93,26 @@ char return (line); } +char + *m_check_multi_and(int32_t fd, char line[], t_msh *msh) +{ + char *and; + + if ((and = ft_strrchr(line, '&')) != NULL && *(and - 1) == '&') + { + and += 1; + while (*and != '\0') + { + if (ft_isspace(*and) == FALSE) + { + return (line); + } + and++; + } + line = m_counter_line_pipes(fd, 2, line, msh); + line = m_check_multi_backslash(fd, line, msh); + line = m_check_multi_pipe(fd, line, msh); + line = m_check_multi_and(fd, line, msh); + } + return (line); +} |