summaryrefslogtreecommitdiff
path: root/blog.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-07-18 18:42:00 -0400
committerJakob Kaivo <jkk@ung.org>2019-07-18 18:42:00 -0400
commit9875fdaae6f71cd00ee4c7e99abf171b7f51116e (patch)
tree8aa0b9dbd4694710f0bc9ddc03f32b2de238739b /blog.c
parentd2e1b116fc3960cc95c4c2012047802379d6911c (diff)
add address to posts
Diffstat (limited to 'blog.c')
-rw-r--r--blog.c11
1 files changed, 8 insertions, 3 deletions
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</body>\n</html>\n"
+#define ADDRESS "<address>Copyright &copy; %d <a href=\"/\">Jakob Kaivo</a> &lt;<a href=\"mailto:jakob@kaivo.net\">jakob@kaivo.net</a>&gt;\n"
+
+#define HTML_TAIL "\n" ADDRESS "</body>\n</html>\n"
int handle_post(void)
{
@@ -77,11 +79,12 @@ int handle_post(void)
}
dprintf(newpost, HTML_HEAD, title);
+ dprintf(newpost, "<h1>%s</h1>\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("<input type=\"submit\">");
puts("</form>");
- printf(HTML_TAIL);
+ time_t t = time(NULL);
+ struct tm *tm = localtime(&t);
+ printf(HTML_TAIL, tm->tm_year + 1900);
return 0;
}