diff options
-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; |