Added Refs Archive Download links - stagit-gemini - Stagit for gemini protocol Openbsd
(HTM) git clone git://thinkerwim.org/stagit-gemini.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit cd22468e3abf2ee1cd0cbe8aacd22bbc5afdafc7
(DIR) parent b3fe27c21606fc9ca17d250ee592f781ec2e4b8b
(HTM) Author: Wim Stockman <wim@thinkerwim.org>
Date: Tue, 14 Mar 2023 17:00:45 +0100
Added Refs Archive Download links
Diffstat:
A .gitignore | 1 +
M stagit-gemini.c | 37 +++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/.gitignore b/.gitignore
@@ -0,0 +1 @@
+*.o
(DIR) diff --git a/stagit-gemini.c b/stagit-gemini.c
@@ -1187,7 +1187,16 @@ writerefs(FILE *fp)
/* print header if it has an entry (first). */
if (++count == 1) {
fprintf(fp, "%s\n", titles[j]);
+ if (j)
+ {
+ fprintf(fp, " %-30.30s", "Download");
fprintf(fp, " %-32.32s", "Name");
+ }
+ else
+ {
+ fprintf(fp, " %-32.32s", "Name");
+ fprintf(fp, " %-32.32s", "Commit message");
+ }
fprintf(fp, " %-16.16s", "Last commit date");
fprintf(fp, " %s\n", "Author");
}
@@ -1195,10 +1204,38 @@ writerefs(FILE *fp)
ci = ris[i].ci;
s = git_reference_shorthand(ris[i].ref);
+ if (!j){
fputs(" ", fp);
utf8pad(buf, sizeof(buf), s, 32, ' ');
gmilink(fp, buf, strlen(buf));
fputs(" ", fp);
+ }
+ if(j)
+ {
+
+ char *shortrepo = NULL;
+ char *shorttag = NULL;
+ char link[128];
+ shortrepo = strdup(name);
+ shorttag = strdup(s);
+
+ if (strstr(shortrepo, ".git"))
+ {
+ size_t len = strlen(shortrepo);
+ shortrepo[len-4] = 0;
+ }
+ if (shorttag[0] == 'v') shorttag = shorttag+1;
+ sprintf(link,"=>/snapshot/%s-%s.tar.gz ",shortrepo,shorttag);
+ utf8pad(buf, sizeof(buf), link, 32, ' ');
+ gmilink(fp, buf, strlen(buf));
+ fputs(" ", fp);
+ utf8pad(buf, sizeof(buf), s, 32, ' ');
+ gmilink(fp, buf, strlen(buf));
+ }
+ fputs(" ", fp);
+ utf8pad(buf, sizeof(buf), ci->summary, 32, ' ');
+ gmilink(fp, buf, strlen(buf));
+
if (ci->author)
printtimeshort(fp, &(ci->author->when));
else