print file as table, add link - stagit-gopher - A git gopher frontend. (mirror) | |
git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2h… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit 52151038885c99a2ddf6b259e6c29601bd7051ef | |
parent 45d8d2f4303b0953f8267116eecde019d1ba1feb | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Mon, 7 Dec 2015 16:40:45 +0100 | |
print file as table, add link | |
Diffstat: | |
M urmoms.c | 14 ++++++++++++-- | |
1 file changed, 12 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/urmoms.c b/urmoms.c | |
@@ -503,11 +503,21 @@ writefiles(FILE *fp) | |
git_repository_index(&index, repo); | |
count = git_index_entrycount(index); | |
+ fputs("<table><thead><tr><td>Mode</td><td>Name</td><td>Size</td></tr><… | |
+ | |
for (i = 0; i < count; i++) { | |
entry = git_index_get_byindex(index, i); | |
- fprintf(fp, "name: %s, size: %" PRIu64 ", mode: %u\n", | |
- entry->path, entry->file_size, entry->mode); | |
+ fputs("<tr><td>", fp); | |
+ fprintf(fp, "%u", entry->mode); /* TODO: fancy print, like: "-… | |
+ fprintf(fp, "</td><td><a href=\"%sfile/", relpath); | |
+ xmlencode(fp, entry->path, strlen(entry->path)); | |
+ fputs("\">", fp); | |
+ xmlencode(fp, entry->path, strlen(entry->path)); | |
+ fputs("</a></td><td align=\"right\">", fp); | |
+ fprintf(fp, "%" PRIu64, entry->file_size); | |
+ fputs("</td></tr>", fp); | |
} | |
+ fputs("</tbody></table>", fp); | |
return 0; | |
} |