diff --git a/src/Makefile b/src/Makefile index 4c85e90..35f1ef1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,13 +1,13 @@ -TARGETS = in.tokend claim.cgi puzzler.cgi pointscli +TARGETS = in.tokend claim.cgi puzzler.cgi pointscli puzzles all: $(TARGETS) in.tokend: in.tokend.o xxtea.o +puzzles: puzzles.o common.o +pointscli: pointscli.o common.o claim.cgi: claim.cgi.o common.o puzzler.cgi: puzzler.cgi.o common.o -puzzles.cgi: puzzles.cgi.o common.o -pointscli: common.o pointscli.o clean: rm -f $(TARGETS) *.o diff --git a/src/common.c b/src/common.c index a21c677..3adeb60 100644 --- a/src/common.c +++ b/src/common.c @@ -13,6 +13,7 @@ * CGI */ static size_t inlen = 0; +static int is_cgi = 0; int cgi_init() @@ -30,6 +31,7 @@ cgi_init() } inlen = atoi(getenv("CONTENT_LENGTH")); + is_cgi = 1; return 0; } @@ -102,9 +104,10 @@ cgi_item(char *str, size_t maxlen) void cgi_head(char *title) { - printf(("Content-type: text/html\r\n" - "\r\n" - "\n" + if (is_cgi) { + printf("Content-type: text/html\r\n\r\n"); + } + printf(("\n" "\n" "
\n" "