From a2dc5174eb19caebf074b446dae129d17485e7bb Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 14 Aug 2020 20:50:57 +0200 Subject: && and || works pretty bav --- src/p_lcom.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/p_lcom.c') diff --git a/src/p_lcom.c b/src/p_lcom.c index e65dd3e..0e849a0 100644 --- a/src/p_lcom.c +++ b/src/p_lcom.c @@ -125,7 +125,6 @@ int8_t int8_t p_lcom(const char line[], - const uint64_t count, t_msh *msh) { /* TODO: norme */ @@ -133,13 +132,21 @@ int8_t t_line *link; char **words; char *ptr; + uint8_t nextif; t_bool next; i = 0; if ((words = p_split_line(line)) == NULL) return (-1); - while (i <= count && words[i] != NULL) + while (words[i] != NULL) { + if (words[i][ft_strlen(words[i]) - 1] == ';') + nextif = 0; + else if (words[i][ft_strlen(words[i]) - 1] == '&') + nextif = 1; + else + nextif = 2; + words[i][ft_strlen(words[i]) - 1] = '\0'; next = FALSE; if ((ptr = ft_strchr(words[i], '|')) != NULL) { @@ -151,6 +158,7 @@ int8_t } if (next == FALSE && (link = s_line_new(words[i], msh)) == NULL) return (-1); + link->nextif = nextif; s_line_add_back(&msh->curr, link); i++; } -- cgit v1.2.3