From 9875fdaae6f71cd00ee4c7e99abf171b7f51116e Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 18 Jul 2019 18:42:00 -0400 Subject: add address to posts --- blog.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'blog.c') diff --git a/blog.c b/blog.c index bcb0419..aebad3c 100644 --- a/blog.c +++ b/blog.c @@ -21,7 +21,9 @@ #define HTML_HEAD DOCTYPE HTML META TITLE ICON STYLE BODY -#define HTML_TAIL "\n\n\n" +#define ADDRESS "
Copyright © %d Jakob Kaivo <jakob@kaivo.net>\n" + +#define HTML_TAIL "\n" ADDRESS "\n\n" int handle_post(void) { @@ -77,11 +79,12 @@ int handle_post(void) } dprintf(newpost, HTML_HEAD, title); + dprintf(newpost, "

%s

\n", title); if (write(newpost, body, strlen(body)) != strlen(body)) { printf("write: %s\n", strerror(errno)); return 0; } - dprintf(newpost, HTML_TAIL); + dprintf(newpost, HTML_TAIL, tm->tm_year + 1900); close(newpost); close(blogdir); @@ -111,7 +114,9 @@ int main(void) puts(""); puts(""); - printf(HTML_TAIL); + time_t t = time(NULL); + struct tm *tm = localtime(&t); + printf(HTML_TAIL, tm->tm_year + 1900); return 0; } -- cgit v1.2.1