ctucx.git: stagit

ctucx' stagit fork

commit 6ef8965209e6b2b177ba65147f12c67c53e775a7
parent e360cf0f1232cab07c495cbc2a66773b031a4d39
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 24 May 2022 00:28:22 +0200

writefooter: show time of generation
1 file changed, 7 insertions(+), 1 deletion(-)
M
stagit.c
|
8
+++++++-
diff --git a/stagit.c b/stagit.c
@@ -64,6 +64,7 @@ static git_repository *repo;
 static const char *relpath = "";
 static const char *repodir;
 
+static char *gen_time;
 static char *name = "";
 static char *strippedname = "";
 static char description[255];

@@ -610,7 +611,7 @@ writeheader(FILE *fp, const char *title, const char *mode)
 void
 writefooter(FILE *fp)
 {
-	fputs("</div>\n</body>\n</html>\n", fp);
+    fprintf(fp, "</div><br><p>Generated on %s (UTC)</p>\n</body>\n</html>\n", gen_time);
 }
 
 size_t

@@ -1235,6 +1236,11 @@ main(int argc, char *argv[])
 	size_t n;
 	int i, fd, r;
 
+    time_t now = time(&now);
+	gen_time = ctime(&now);
+	gen_time[24] = '\0';
+
+
 	for (i = 1; i < argc; i++) {
 		if (argv[i][0] != '-') {
 			if (repodir)