diff options
Diffstat (limited to 'badroff.c')
-rw-r--r-- | badroff.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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); |