stagit-gopher

[fork] gopher git frontend
Log | Files | Refs | README | LICENSE

commit 8bad0e073142b1347085d04646fd64e11a7a7c2a
parent cba17854219972673d7079e9cb11185cc2565710
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat,  8 Sep 2018 14:40:03 +0200

optimize to truncate to 79 characters, remove white-space padding at end

Diffstat:
Mstagit-gopher-index.c | 4++--
Mstagit-gopher.c | 14+++++++-------
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/stagit-gopher-index.c b/stagit-gopher-index.c @@ -146,7 +146,7 @@ writeheader(FILE *fp) } fprintf(fp, "%-20.20s ", "Name"); - fprintf(fp, "%-50.50s ", "Description"); + fprintf(fp, "%-39.39s ", "Description"); fprintf(fp, "%s\n", "Last commit"); } @@ -185,7 +185,7 @@ writelog(FILE *fp) utf8pad(buf, sizeof(buf), stripped_name, 20, ' '); gphlink(fp, buf, strlen(buf)); fputs(" ", fp); - utf8pad(buf, sizeof(buf), description, 50, ' '); + utf8pad(buf, sizeof(buf), description, 39, ' '); gphlink(fp, buf, strlen(buf)); fputs(" ", fp); if (author) diff --git a/stagit-gopher.c b/stagit-gopher.c @@ -653,10 +653,10 @@ writelogline(FILE *fp, struct commitinfo *ci) else fputs(" ", fp); fputs(" ", fp); - utf8pad(buf, sizeof(buf), ci->summary ? ci->summary : "", 50, ' '); + utf8pad(buf, sizeof(buf), ci->summary ? ci->summary : "", 40, ' '); gphlink(fp, buf, strlen(buf)); fputs(" ", fp); - utf8pad(buf, sizeof(buf), ci->author ? ci->author->name : "", 25, ' '); + utf8pad(buf, sizeof(buf), ci->author ? ci->author->name : "", 19, '\0'); gphlink(fp, buf, strlen(buf)); fprintf(fp, "|%s/commit/%s.gph|server|port]\n", relpath, ci->oid); } @@ -700,7 +700,7 @@ writelog(FILE *fp, const git_oid *oid) writelogline(fp, ci); nlogcommits--; if (!nlogcommits && ci->parentoid[0]) - fprintf(fp, "%18.18sMore commits remaining [...]\n", ""); + fprintf(fp, "%16.16s More commits remaining [...]\n", ""); } if (cachefile) @@ -1048,7 +1048,7 @@ writerefs(FILE *fp) /* print header if it has an entry (first). */ if (++count == 1) { fprintf(fp, "%s\n", titles[j]); - fprintf(fp, " %-20.20s", "Name"); + fprintf(fp, " %-32.32s", "Name"); fprintf(fp, " %-16.16s", "Last commit date"); fprintf(fp, " %s\n", "Author"); } @@ -1056,7 +1056,7 @@ writerefs(FILE *fp) name = git_reference_shorthand(r); fputs(" ", fp); - utf8pad(buf, sizeof(buf), name, 20, ' '); + utf8pad(buf, sizeof(buf), name, 32, ' '); gphlink(fp, buf, strlen(buf)); fputs(" ", fp); if (ci->author) @@ -1065,7 +1065,7 @@ writerefs(FILE *fp) fputs(" ", fp); fputs(" ", fp); if (ci->author) { - utf8pad(buf, sizeof(buf), ci->author->name, 25, ' '); + utf8pad(buf, sizeof(buf), ci->author->name, 25, '\0'); gphlink(fp, buf, strlen(buf)); } fputs("\n", fp); @@ -1228,7 +1228,7 @@ main(int argc, char *argv[]) writeheader(fp, "Log"); fprintf(fp, "%-16.16s ", "Date"); - fprintf(fp, "%-50.50s ", "Commit message"); + fprintf(fp, "%-40.40s ", "Commit message"); fprintf(fp, "%s\n", "Author"); if (cachefile && head) {