diff options
| author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-12-18 21:04:29 +0100 | 
|---|---|---|
| committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-12-18 21:04:29 +0100 | 
| commit | f543cdc19dae32a70e7efae35f499008bacb2f6b (patch) | |
| tree | 59ddbdfe412ba4d0f69d9b798cd9e70836d95919 /src/m_loop_next.c | |
| parent | Removed TODO.org (diff) | |
| parent | qweqweqweqwe (diff) | |
| download | 42-minishell-f543cdc19dae32a70e7efae35f499008bacb2f6b.tar.gz 42-minishell-f543cdc19dae32a70e7efae35f499008bacb2f6b.tar.bz2 42-minishell-f543cdc19dae32a70e7efae35f499008bacb2f6b.tar.xz 42-minishell-f543cdc19dae32a70e7efae35f499008bacb2f6b.tar.zst 42-minishell-f543cdc19dae32a70e7efae35f499008bacb2f6b.zip | |
Merge branch 'master' of jozanleclerc.xyz:42-minishell
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)  { | 
