summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-12-11 18:23:46 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-12-11 18:23:46 +0100
commit06ba84a1273021045f31fa73a4775cc79f1ddf08 (patch)
tree607780840c20af46962fa1dc6ec086148dcd777a
parentval (diff)
download42-minishell-06ba84a1273021045f31fa73a4775cc79f1ddf08.tar.gz
42-minishell-06ba84a1273021045f31fa73a4775cc79f1ddf08.tar.bz2
42-minishell-06ba84a1273021045f31fa73a4775cc79f1ddf08.tar.xz
42-minishell-06ba84a1273021045f31fa73a4775cc79f1ddf08.tar.zst
42-minishell-06ba84a1273021045f31fa73a4775cc79f1ddf08.zip
In progress
-rw-r--r--.gitignore1
-rw-r--r--TODO.org9
-rw-r--r--src/m_loop.c20
3 files changed, 23 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index d64da46..aa126af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -156,4 +156,5 @@ compile_flags.txt
/mini
.ccls*
tags
+TAGS
*.supp
diff --git a/TODO.org b/TODO.org
index ef6eeae..2cd48f0 100644
--- a/TODO.org
+++ b/TODO.org
@@ -33,7 +33,7 @@
CLOSED: [2020-10-22 Thu 21:47]
** DONE 'echo qweqwe 1>file' file has 'qweqwe 1' in it
CLOSED: [2020-10-27 Tue 19:35]
-** CANCELED alias ls='clear; ls | grep qwe' <--- aliases not substed in the right place
+** CANCELLED alias ls='clear; ls | grep qwe' <--- aliases not substed in the right place
CLOSED: [2020-10-19 Mon 19:56]
** DONE forked write(2) stuff on cd
** DONE Multiline && ||
@@ -82,7 +82,7 @@
CLOSED: [2020-09-28 Mon 19:30]
+ [X] base
+ [X] <<- to skip tabs
-** CANCELED if else [0/4]
+** CANCELLED if else [0/4]
CLOSED: [2020-12-07 Mon 15:32]
+ [ ] if - fi
+ [ ] else
@@ -94,7 +94,8 @@
** DONE Termcaps
CLOSED: [2020-12-07 Mon 15:31]
** TODO -i option (alias and history in scripts, etc)
-** TODO Simple arithmetics $((a + 1))
-** CANCELED &
+** CANCELLED Simple arithmetics $((a + 1))
+ CLOSED: [2020-12-11 Fri 16:01]
+** CANCELLED &
CLOSED: [2020-10-21 Wed 16:41]
diff --git a/src/m_loop.c b/src/m_loop.c
index c7ca9cc..e658593 100644
--- a/src/m_loop.c
+++ b/src/m_loop.c
@@ -36,12 +36,15 @@
#include "u_utils.h"
#include "u_parse.h"
#include "u_vars.h"
+#include "u_vars_next.h"
static void m_parse_and_run_line(char line[],
unsigned char previf,
t_msh *msh)
{
t_line_block *ptr;
+ size_t i;
+ t_bool pipe;
p_line(line, msh);
ptr = msh->curr;
@@ -50,14 +53,25 @@ static void m_parse_and_run_line(char line[],
if ((previf == 0) || (previf == 1 && msh->ret == 0)
|| (previf == 2 && msh->ret != 0))
{
- if ((p_find_good_pipe(ptr->lblock) == TRUE
- && (s_split_pipes(ptr->lblock, msh)) == NULL)
- || (msh->com = s_com_new(ptr->lblock, msh)) == NULL)
+ pipe = p_find_good_pipe(ptr->lblock);
+ if ((pipe == TRUE && s_split_pipes(ptr->lblock, msh) == NULL)
+ || (msh->com = s_com_new(ptr->lblock, msh)) == NULL)
{
previf = ptr->nextif;
ptr = ptr->next;
continue ;
}
+ if (msh->com != NULL && pipe == FALSE)
+ {
+ i = 0;
+ while (msh->com->argv != NULL && msh->com->argv[i] != NULL)
+ i++;
+ if (msh->com->argv != NULL && msh->com->argv[0] != NULL)
+ ft_dprintf(1, "\r[%s]\n", msh->com->argv[i]);
+ else
+ ft_dprintf(1, "\r[%s]\n", msh->com->bin);
+ /* u_subst_var_value("$_", const char *newval, msh); */
+ }
e_line_block(msh);
s_com_destroy(&msh->com);
s_lpipes_clear(&msh->pipes);