From 5c9512ce27eb5973ee5a48c2eb3ea0e195f08acf Mon Sep 17 00:00:00 2001
From: Neil
Date: Fri, 11 Jun 2021 23:22:08 -0700
Subject: [PATCH] Xmacros are too much work.
---
src/badass.h | 2 ++
src/movie.h | 2 ++
src/vote.c | 16 ++++++++--------
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/badass.h b/src/badass.h
index eb4dedc..0b01cb0 100644
--- a/src/badass.h
+++ b/src/badass.h
@@ -2,6 +2,8 @@
#define ADDR_FILE "badass.addr"
#define HTML_FILE "badass.html"
#define VALID_REFERER "http://neil.chaosnet.org/"
+#define VOTE_TITLE "Which of these professions is the most badass?"
+#define VOTE_BACK "http://neil.chaosnet.org/"
/* #define VOTES(X) \
X('a', "astronaut"), \
diff --git a/src/movie.h b/src/movie.h
index 9d73937..c021760 100644
--- a/src/movie.h
+++ b/src/movie.h
@@ -2,6 +2,8 @@
#define ADDR_FILE "movie.addr"
#define HTML_FILE "movie.html"
#define VALID_REFERER "http://neil.chaosnet.org/multiverse/"
+#define VOTE_TITLE "Which movie should we watch?"
+#define VOTE_BACK "Multiverse"
/*#define VOTES(X) \
X('a', "A"), \
diff --git a/src/vote.c b/src/vote.c
index 6323437..4ba7824 100644
--- a/src/vote.c
+++ b/src/vote.c
@@ -3,14 +3,15 @@
@subtitle Vote
- These are hard-coded CGI programmes for simple voting. */
+ These are hard-coded CGI programmes for simple voting. Compile with different
+ headers to change the voting scheme. */
#include /* getenv(), atoi() */
#include /* printf(), FILE, f*() */
#include /* strstr() */
#include /* time() */
-static struct vote {
+struct vote {
const char *name;
unsigned vote;
const char token;
@@ -143,7 +144,7 @@ static char *votes_html(void) {
fprintf(htf, "\n"
"\n\n"
"\n"
- "Which of these professions is the most badass?
"
+ "" VOTE_TITLE "
\n\n"
"\nCurrent results:\n
\n\n");
/* write out each name and vote */
for(votep = votes; votep < votes + votes_size; votep++)
@@ -155,10 +156,9 @@ static char *votes_html(void) {
fprintf(htf, "%s: %u vote%c
",
votep->name, votep->vote, (votep->vote == 1) ? ' ' : 's');
}
- fprintf(htf, "Go back to "
- "http://neil.chaosnet.org/.
\n");
- fprintf(htf, "\n\n");
- fprintf(htf, "