diff options
Diffstat (limited to '')
-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) { |