diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-12-18 20:18:38 +0100 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-12-18 20:18:38 +0100 |
commit | bbc9757dccbc50fb051ca3cff585a9100023b1b1 (patch) | |
tree | cbf0c5280545d47cea0d7885e94c711edd4c5cc7 /src/m_loop_next.c | |
parent | Merge branch 'leaktarace' of jozanleclerc.xyz:42-minishell into leaktarace (diff) | |
download | 42-minishell-bbc9757dccbc50fb051ca3cff585a9100023b1b1.tar.gz 42-minishell-bbc9757dccbc50fb051ca3cff585a9100023b1b1.tar.bz2 42-minishell-bbc9757dccbc50fb051ca3cff585a9100023b1b1.tar.xz 42-minishell-bbc9757dccbc50fb051ca3cff585a9100023b1b1.tar.zst 42-minishell-bbc9757dccbc50fb051ca3cff585a9100023b1b1.zip |
qweqweqweqwe
Diffstat (limited to 'src/m_loop_next.c')
-rw-r--r-- | src/m_loop_next.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/m_loop_next.c b/src/m_loop_next.c index e29b6dd..cde3ccf 100644 --- a/src/m_loop_next.c +++ b/src/m_loop_next.c @@ -14,10 +14,42 @@ #include <unistd.h> #include "d_define.h" +#include "e_line.h" #include "m_loop_counter.h" #include "m_loop_multis.h" #include "s_struct.h" #include "u_utils.h" +#include "s_com.h" +#include "s_lpipes.h" +#include "u_vars_next.h" + +short m_set_all(t_line_block *ptr, unsigned char previf, + t_bool pipe, t_msh *msh) +{ + size_t i; + + 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; + return (-1); + } + 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) + u_subst_var_value("$_", msh->com->argv[i - 1], msh); + else + u_subst_var_value("$_", msh->com->bin, msh); + } + e_line_block(msh); + s_com_destroy(&msh->com); + s_lpipes_clear(&msh->pipes); + return (1); +} char *m_check_multi_backslash(int fd, char line[], t_msh *msh) { |