summaryrefslogtreecommitdiffstats
path: root/src/m_loop_next.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/m_loop_next.c')
-rw-r--r--src/m_loop_next.c32
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)
{