diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-14 20:50:57 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-14 20:50:57 +0200 |
commit | a2dc5174eb19caebf074b446dae129d17485e7bb (patch) | |
tree | 7fcf83e441d10ed9ef60db10de819b1c927dc263 /src/p_lcom.c | |
parent | Just a few more line and we're good (diff) | |
download | 42-minishell-a2dc5174eb19caebf074b446dae129d17485e7bb.tar.gz 42-minishell-a2dc5174eb19caebf074b446dae129d17485e7bb.tar.bz2 42-minishell-a2dc5174eb19caebf074b446dae129d17485e7bb.tar.xz 42-minishell-a2dc5174eb19caebf074b446dae129d17485e7bb.tar.zst 42-minishell-a2dc5174eb19caebf074b446dae129d17485e7bb.zip |
&& and || works pretty bav
Diffstat (limited to '')
-rw-r--r-- | src/p_lcom.c | 12 |
1 files changed, 10 insertions, 2 deletions
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++; } |