aboutsummaryrefslogtreecommitdiff
path: root/badroff.c
diff options
context:
space:
mode:
Diffstat (limited to 'badroff.c')
-rw-r--r--badroff.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/badroff.c b/badroff.c
index 7bdb3e7..e9346c3 100644
--- a/badroff.c
+++ b/badroff.c
@@ -90,11 +90,15 @@ char* fillline(char* txt){
memset(str, txt[0], width);
return str;
}
+char* token(char* txt, char c) {
+ char* end = strchr(txt, c);
+ *end = 0;
+ return end+1;
+}
char* leader(char* txt){
- char* cnxt;
- char* start = strtok_r(txt, "|", &cnxt);
- char* repeat = strtok_r(NULL, "|", &cnxt);
- char* end = strtok_r(NULL, "|", &cnxt);
+ char* start = txt;
+ char* repeat = token(start, '|');
+ char* end = token(repeat, '|');
char* fin = malloc(sizeof(char)*(width+2));
fin[width] = '\n'; fin[width+1] = 0;
strcpy(fin, start);