diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-26 15:07:36 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-26 15:07:36 +0200 |
commit | a6fb6641c1a1aa567fbbe5a82e38aee67e4bd3b3 (patch) | |
tree | d97cfeb95f96f5af4231ab969c0a26992f22e385 /src | |
parent | Tomorrow (diff) | |
download | 42-minishell-a6fb6641c1a1aa567fbbe5a82e38aee67e4bd3b3.tar.gz 42-minishell-a6fb6641c1a1aa567fbbe5a82e38aee67e4bd3b3.tar.bz2 42-minishell-a6fb6641c1a1aa567fbbe5a82e38aee67e4bd3b3.tar.xz 42-minishell-a6fb6641c1a1aa567fbbe5a82e38aee67e4bd3b3.tar.zst 42-minishell-a6fb6641c1a1aa567fbbe5a82e38aee67e4bd3b3.zip |
; end bug fix
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_p_lcom.c | 2 | ||||
-rw-r--r-- | src/ft_p_line.c | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/ft_p_lcom.c b/src/ft_p_lcom.c index 227ab97..27df158 100644 --- a/src/ft_p_lcom.c +++ b/src/ft_p_lcom.c @@ -132,7 +132,7 @@ int8_t i = 0; if (!(words = ft_split(line, ';'))) return (-1); - ft_printf("words1 (%s) | words2 (%s)\n", *words, *(words + 1)); + ft_printf("words1 (%s) | words2 (%s) | count %lu\n", *words, *(words + 1), count); while (i <= count) { if (!(link = ft_lcom_new(words[i]))) diff --git a/src/ft_p_line.c b/src/ft_p_line.c index 81e02d2..07c5fac 100644 --- a/src/ft_p_line.c +++ b/src/ft_p_line.c @@ -23,18 +23,22 @@ void ft_p_line(char line[], t_msh *msh) { - uint64_t i; + char *ptr; uint64_t count; - i = 0; count = 0; - while (line[i] != '\0') + ptr = line; + while (*ptr != '\0') { - if (line[i] == ';') + if (*ptr == ';') { - count++; + count += 1; } - i++; + ptr++; + } + if (*(ptr - 1) == ';') + { + count -= 1; } if (ft_p_lcom(line, count, msh) < 0) { |