diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-14 15:24:12 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-14 15:24:12 +0200 |
commit | 294adc19078fa8d196ee1d787ec24619f9976178 (patch) | |
tree | 9446807d7ee909046f1cb9f2bd1c7711bbe0b857 /src/p_lcom.c | |
parent | Removed bloat (diff) | |
download | 42-minishell-294adc19078fa8d196ee1d787ec24619f9976178.tar.gz 42-minishell-294adc19078fa8d196ee1d787ec24619f9976178.tar.bz2 42-minishell-294adc19078fa8d196ee1d787ec24619f9976178.tar.xz 42-minishell-294adc19078fa8d196ee1d787ec24619f9976178.tar.zst 42-minishell-294adc19078fa8d196ee1d787ec24619f9976178.zip |
I must split
Diffstat (limited to '')
-rw-r--r-- | src/p_lcom.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/p_lcom.c b/src/p_lcom.c index 339ab17..e65dd3e 100644 --- a/src/p_lcom.c +++ b/src/p_lcom.c @@ -19,6 +19,7 @@ #include "d_define.h" #include "f_fail.h" +#include "p_split.h" #include "s_line.h" #include "s_lpipes.h" #include "s_struct.h" @@ -124,22 +125,23 @@ int8_t int8_t p_lcom(const char line[], - const uint64_t count, - t_msh *msh) + const uint64_t count, + t_msh *msh) { /* TODO: norme */ uint64_t i; t_line *link; char **words; + char *ptr; t_bool next; i = 0; - if (!(words = ft_split(line, ';'))) + if ((words = p_split_line(line)) == NULL) return (-1); - while (i <= count && words[i]) + while (i <= count && words[i] != NULL) { next = FALSE; - if (ft_strchr(words[i], '|')) + if ((ptr = ft_strchr(words[i], '|')) != NULL) { if ((link = s_line_new(NULL, msh)) == NULL) return (-1); |