diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-08 19:32:40 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-08 19:32:40 +0200 |
commit | d742075e1af0c063ef9677f157263c0d45253f73 (patch) | |
tree | 656be50d447b90308647a253e3ba6ba75a751b13 /src/m_loop.c | |
parent | Update (diff) | |
download | 42-minishell-d742075e1af0c063ef9677f157263c0d45253f73.tar.gz 42-minishell-d742075e1af0c063ef9677f157263c0d45253f73.tar.bz2 42-minishell-d742075e1af0c063ef9677f157263c0d45253f73.tar.xz 42-minishell-d742075e1af0c063ef9677f157263c0d45253f73.tar.zst 42-minishell-d742075e1af0c063ef9677f157263c0d45253f73.zip |
Rework in progress
Diffstat (limited to 'src/m_loop.c')
-rw-r--r-- | src/m_loop.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/m_loop.c b/src/m_loop.c index 9d00f2b..9ecea98 100644 --- a/src/m_loop.c +++ b/src/m_loop.c @@ -22,15 +22,36 @@ #include "m_loop_next.h" #include "m_prompt.h" #include "p_line.h" +#include "s_com.h" +#include "s_lpipes.h" #include "s_line.h" #include "u_vars.h" static void m_parse_and_run_line(char line[], t_msh *msh) { + t_line_block *ptr; + uint8_t previf; + p_line(line, msh); ft_memdel((void*)&line); - e_line(msh); + previf = 0; + ptr = msh->curr; + while (ptr != NULL) + { + ft_printf("[%s]\n", ptr->lblock); + if ((previf == 0) || (previf == 1 && msh->ret == 0) || + (previf == 2 && msh->ret != 0)) + { + if ((msh->com = s_com_new(msh->curr->lblock, msh)) == NULL) + break ; + e_line(msh); + } + else if (msh->pipes != NULL) + s_lpipes_clear(&msh->pipes); + previf = ptr->nextif; + ptr = ptr->next; + } s_line_clear(&msh->curr); } |