From d0889f96707eb9bc27b3454269d4a7f3ccd35505 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 18 Jul 2019 19:22:27 -0400 Subject: remove cruft --- blog.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'blog.c') diff --git a/blog.c b/blog.c index dedfad7..5ff100b 100644 --- a/blog.c +++ b/blog.c @@ -9,29 +9,8 @@ #include #include "blog.h" -#include - -#define DOCTYPE "\n" -#define HTML "\n" -#define META "\n" -#define TITLE "%s\n" -#define ICON "\n" -#define STYLE "\n" -#define BODY "\n\n" - -#define HTML_HEAD DOCTYPE HTML META TITLE ICON STYLE BODY - -#define ADDRESS "
Copyright © %d Jakob Kaivo <jakob@kaivo.net>\n" - -#define HTML_TAIL "\n" ADDRESS "\n\n" - int handle_post(void) { - /* - printf("Status: 200 OK\r\n"); - printf("Content-Type: text/plain\r\n\r\n"); - */ - read_post_data(); if (!authenticate(find_post_data("username"), find_post_data("password"))) { printf("Status 403 Forbidden\r\n"); @@ -42,7 +21,6 @@ int handle_post(void) int blogdir = open(DATA_DIRECTORY, O_DIRECTORY); if (blogdir == -1) { - printf("open(%s): %s\n", DATA_DIRECTORY, strerror(errno)); return 1; } @@ -69,8 +47,7 @@ int handle_post(void) int newpost = openat(blogdir, uri, O_WRONLY | O_CREAT, 0644); if (newpost == -1) { - printf("open(%s): %s\n", uri, strerror(errno)); - return 0; + return 1; } char *body = find_post_data("body"); @@ -81,8 +58,7 @@ 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; + return 1; } dprintf(newpost, HTML_TAIL, tm->tm_year + 1900); -- cgit v1.2.1