summaryrefslogtreecommitdiffstats
path: root/src/ft_p_lcom.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-05-07 13:49:10 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-05-07 13:49:10 +0200
commit9666a0a0ef6f5a4fb30bac93797d0f029ad8294a (patch)
treea09f917723ae3a0dfeaef025b5e9a76e2c8602f2 /src/ft_p_lcom.c
parentPreparing the structs (diff)
download42-minishell-9666a0a0ef6f5a4fb30bac93797d0f029ad8294a.tar.gz
42-minishell-9666a0a0ef6f5a4fb30bac93797d0f029ad8294a.tar.bz2
42-minishell-9666a0a0ef6f5a4fb30bac93797d0f029ad8294a.tar.xz
42-minishell-9666a0a0ef6f5a4fb30bac93797d0f029ad8294a.tar.zst
42-minishell-9666a0a0ef6f5a4fb30bac93797d0f029ad8294a.zip
Still pipin'
Diffstat (limited to '')
-rw-r--r--src/ft_p_lcom.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/ft_p_lcom.c b/src/ft_p_lcom.c
index 9a678e6..823db3b 100644
--- a/src/ft_p_lcom.c
+++ b/src/ft_p_lcom.c
@@ -17,8 +17,10 @@
#include <unistd.h>
#include <errno.h>
+#include "ft_d_define.h"
#include "ft_f_fail.h"
#include "ft_s_lcom.h"
+#include "ft_s_lpipes.h"
#include "ft_s_struct.h"
static void
@@ -125,19 +127,30 @@ int8_t
const uint64_t count,
t_msh *msh)
{
- uint64_t i;
- t_lcom *link;
- char **words;
+ /* TODO: norme */
+ uint64_t i;
+ t_lcom *link;
+ struct s_lpipes *lpipes;
+ char **words;
+ t_bool next;
i = 0;
if (!(words = ft_split(line, ';')))
return (-1);
while (i <= count && words[i])
{
- if (!(link = ft_lcom_new(words[i], msh)))
+ next = FALSE;
+ /* TODO: split pipes here */
+ if (ft_strchr(words[i], '|'))
{
- return (-1);
+ if (!(link = ft_lcom_new(NULL, msh)))
+ return (-1);
+ if (!(lpipes = ft_split_pipes(words[i], link, msh)))
+ return (-1);
+ next = TRUE;
}
+ if (next == FALSE && !(link = ft_lcom_new(words[i], NULL, msh)))
+ return (-1);
ft_lcom_add_back(&msh->curr, link);
i++;
}