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/ft_p_line.c | |
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 '')
-rw-r--r-- | src/ft_p_line.c | 16 |
1 files changed, 10 insertions, 6 deletions
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) { |