diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-05-29 01:14:24 -0400 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-05-29 01:14:24 -0400 |
commit | 99dee0124378fc66e1db94d3d010786bcbb15725 (patch) | |
tree | fe1cc83e33a9f0c6da719901803c924935db945c | |
parent | 0caf0888e98bb504f7421cfa085f4821eecf7966 (diff) |
badroff leader errors
-rw-r--r-- | badroff.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -107,8 +107,11 @@ static char* fillline(char* txt){ } static char* token(char* txt, char c) { char* end = strchr(txt, c); - if (end) *end = 0; - return end+1; + if (end) { + *end = 0; + return end+1; + } + return NULL; } static char* leader(char* txt){ char *start, *repeat, *end, *fin; @@ -117,8 +120,8 @@ static char* leader(char* txt){ repeat = " . "; end = ""; } else if ( !(end = token(repeat, '|') ) ) { - repeat = " . "; end = repeat; + repeat = " . "; } fin = malloc(sizeof(char)*(width+2)); fin[width] = '\n'; fin[width+1] = 0; |