herbe

[fork] notifications
Log | Files | Refs | README | LICENSE

commit 5cead86549c8ae489cc3fca2f1bc5512e0510d42
parent 89dbfdbfb8ddf8519278212d227aba939f6f1ee5
Author: Samuel Dudik <samuel.dudik@gmail.com>
Date:   Sun,  2 Aug 2020 19:29:13 +0200

Fix bug with long words causing infinite loop

Diffstat:
Mherbe.c | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/herbe.c b/herbe.c @@ -89,10 +89,15 @@ int main(int argc, char *argv[]) break; } - while (body[eols[num_of_lines - 1] + eol] != ' ') + int temp = eol; + + while (body[eols[num_of_lines - 1] + eol] != ' ' && eol) --eol; - eol++; + if (eol == 0) + eol = temp; + else + eol++; remainder -= eol; if (eols_size < num_of_lines + 1)