From c1dfd0bb139f58a9f34dbfc61920b59df00c70c1 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Mon, 13 Jul 2020 18:14:22 -0400 Subject: Incorporate CSS into C without file2c It's a shame file2c is not available everywhere. --- server.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'server.c') diff --git a/server.c b/server.c index bc05299..c384020 100644 --- a/server.c +++ b/server.c @@ -21,6 +21,7 @@ #include #include +#include "css.h" #include "server.h" sqlite3 *db; @@ -51,15 +52,13 @@ const struct kvalid Keys[KeysLen] = { #undef X }; -static const char CSS[] = { -#include "default.css.h" -}; -static const char *Cache = "public, max-age=86400, immutable"; - static enum kcgi_err stylesheet(struct kreq *req) { if (req->mime != KMIME_TEXT_CSS) return httpFail(req, KHTTP_404); return httpHead(req, KHTTP_200, KMIME_TEXT_CSS) - || khttp_head(req, kresps[KRESP_CACHE_CONTROL], "%s", Cache) + || khttp_head( + req, kresps[KRESP_CACHE_CONTROL], + "public, max-age=86400, immutable" + ) || khttp_body(req) || khttp_write(req, CSS, sizeof(CSS)); } -- cgit 1.4.1