summaryrefslogtreecommitdiffstats
path: root/src/m_loop.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-08 19:32:40 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-08 19:32:40 +0200
commitd742075e1af0c063ef9677f157263c0d45253f73 (patch)
tree656be50d447b90308647a253e3ba6ba75a751b13 /src/m_loop.c
parentUpdate (diff)
download42-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 '')
-rw-r--r--src/m_loop.c23
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);
}