diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-07-18 18:42:00 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-07-18 18:42:00 -0400 |
commit | 9875fdaae6f71cd00ee4c7e99abf171b7f51116e (patch) | |
tree | 8aa0b9dbd4694710f0bc9ddc03f32b2de238739b /blog.c | |
parent | d2e1b116fc3960cc95c4c2012047802379d6911c (diff) |
add address to posts
Diffstat (limited to 'blog.c')
-rw-r--r-- | blog.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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 © %d <a href=\"/\">Jakob Kaivo</a> <<a href=\"mailto:jakob@kaivo.net\">jakob@kaivo.net</a>>\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; } |