aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-05-29 01:14:24 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-05-29 01:14:24 -0400
commit99dee0124378fc66e1db94d3d010786bcbb15725 (patch)
treefe1cc83e33a9f0c6da719901803c924935db945c
parent0caf0888e98bb504f7421cfa085f4821eecf7966 (diff)
badroff leader errors
-rw-r--r--badroff.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/badroff.c b/badroff.c
index 80d347c..e19bf03 100644
--- a/badroff.c
+++ b/badroff.c
@@ -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;