summaryrefslogtreecommitdiffstats
path: root/src/e_line.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/e_line.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 'src/e_line.c')
-rw-r--r--src/e_line.c45
1 files changed, 10 insertions, 35 deletions
diff --git a/src/e_line.c b/src/e_line.c
index f47170f..bb97556 100644
--- a/src/e_line.c
+++ b/src/e_line.c
@@ -22,8 +22,7 @@
#include "s_struct.h"
static uint8_t
- get_builtin_id(const char bin[],
- t_msh *msh)
+ e_get_builtin_id(const char bin[], t_msh *msh)
{
uint8_t i;
@@ -36,44 +35,20 @@ static uint8_t
return (i);
}
-static void
- e_line_destroy(t_line *ptr)
-{
- if (ptr->pipes != NULL)
- {
- s_lpipes_clear(&ptr->pipes);
- }
-}
-
void
e_line(t_msh *msh)
{
- t_line *ptr;
uint8_t bu_id;
- uint8_t previf;
- previf = 0;
- ptr = msh->curr;
- while (ptr != NULL)
+ if (msh->pipes != NULL)
+ e_pipes(msh);
+ else if (msh->com != NULL)
{
- if ((previf == 0) || (previf == 1 && msh->ret == 0) ||
- (previf == 2 && msh->ret != 0))
- {
- if (ptr->pipes != NULL)
- e_pipes(ptr, msh);
- else if (ptr->com != NULL)
- {
- if (ptr->com->bin != NULL &&
- (bu_id = get_builtin_id(ptr->com->bin, msh))
- < FT_BUILTINS_COUNT)
- e_builtin(ptr->com, bu_id, msh);
- else if (ptr->com->bin != NULL)
- e_extern(ptr->com, msh);
- }
- }
- else
- e_line_destroy(ptr);
- previf = ptr->nextif;
- ptr = ptr->next;
+ if (msh->com->bin != NULL &&
+ (bu_id = e_get_builtin_id(msh->com->bin, msh))
+ < FT_BUILTINS_COUNT)
+ e_builtin(msh->com, bu_id, msh);
+ else if (msh->com->bin != NULL)
+ e_extern(msh->com, msh);
}
}