From ef71654b996bcbdb769fe53f63f54afd54b741b7 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Tue, 31 Mar 2020 23:19:35 -0400
Subject: added leader command
---
badroff.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/badroff.c b/badroff.c
index 123deba..c28e153 100644
--- a/badroff.c
+++ b/badroff.c
@@ -86,9 +86,25 @@ char* fillline(char* txt){
memset(str, txt[0], width);
return str;
}
+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* fin = malloc(sizeof(char)*(width+2));
+ fin[width] = '\n'; fin[width+1] = 0;
+ strcpy(fin, start);
+ size_t max = width-strlen(end); size_t rptln = strlen(repeat);
+ strcpy(fin+max, end);
+ for (int i=strlen(start); i