tadd preliminary poll display logic - vote - simple cgi voting system for web and gopher
(HTM) git clone git://src.adamsgaard.dk/vote
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit b2d48df0f716bde905d6eb17e0520014cc3171ca
(DIR) parent 60cce502c63f387f1505a113c9b90ca14f929b06
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Sun, 27 Sep 2020 02:18:50 +0200
add preliminary poll display logic
Diffstat:
M vote.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/vote.c b/vote.c
t@@ -4,6 +4,7 @@
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
+#include <fcntl.h>
#define OUT(s) (fputs((s), stdout))
#define POLLS_DIR "polls"
t@@ -30,6 +31,18 @@ print_html_foot() {
"</html>\n");
}
+void
+show_poll(const char *poll_name) {
+ FILE *fd;
+ if ((fd = fopen(poll_name, "r")) != NULL) {
+ fclose(fd);
+ } else {
+ fprintf(stderr, "poll_open %s: %s\n", poll_name, strerror(errno));
+ die_500();
+ }
+
+}
+
/* from hiltjo posthuma's frontends */
char *
getparam(const char *query, const char *s) {
t@@ -80,10 +93,12 @@ main() {
}
}
+ print_html_head();
+
parse_query();
+ if (*poll)
+ printf("<p>poll: '%s'</p>\n", poll);
- print_html_head();
- printf("<p>poll: '%s'</p>\n", poll);
print_html_foot();
return 0;