diff options
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); } |