make table more readable by shrinking some columns horizontally

This commit is contained in:
Sean Barrett
2015-04-14 03:09:01 -07:00
parent 3c2090565d
commit c1ad6b09de
3 changed files with 16 additions and 6 deletions

View File

@ -17,7 +17,7 @@ int main(int argc, char **argv)
char **tokens = stb_tokens_stripwhite(list[i], "|", &num); // stb_tokens -- tokenize string into malloced array of strings
int num_lines;
char **lines = stb_stringfile(stb_sprintf("../%s", tokens[0]), &num_lines);
char *s1, *s2;
char *s1, *s2,*s3;
s1 = strchr(lines[0], '-');
if (!s1) stb_fatal("Couldn't find '-' before version number in %s", tokens[0]); // stb_fatal -- print error message & exit
s2 = strchr(s1+2, '-');
@ -26,7 +26,17 @@ int main(int argc, char **argv)
s1 += 1;
s1 = stb_trimwhite(s1); // stb_trimwhite -- advance pointer to after whitespace & delete trailing whitespace
if (*s1 == 'v') ++s1;
fprintf(f, "**%s** | %s", tokens[0], s1);
s3 = tokens[0];
stb_trimwhite(s3);
if (strlen(s3) < 21) {
fprintf(f, "**%s** | %s", tokens[0], s1);
} else {
char buffer[256];
strncpy(buffer, s3, 18);
buffer[18] = 0;
strcat(buffer, "...");
fprintf(f, "**%s** | %s", buffer, s1);
}
s1 = stb_trimwhite(tokens[1]); // stb_trimwhite -- advance pointer to after whitespace & delete trailing whitespace
s2 = stb_dupreplace(s1, " ", "&nbsp;"); // stb_dupreplace -- search & replace string and malloc result
fprintf(f, " | %s", s2);