From 2c01baef1b18d5b58b70c94b08dd2a8cb4d3c930 Mon Sep 17 00:00:00 2001 From: - <-> Date: Tue, 8 Feb 2022 19:31:34 -0800 Subject: [PATCH] Adjusted program for static html generation --- src/dbquery.c | 8 ++++---- src/main.c | 14 +++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/dbquery.c b/src/dbquery.c index 7ae8dbb..7705e03 100644 --- a/src/dbquery.c +++ b/src/dbquery.c @@ -31,7 +31,7 @@ static inline void print_tblheader(const char *c) { char *labels; switch (*c) { default: - labels = "\ + labels = "
\ \ \ \ @@ -41,7 +41,7 @@ static inline void print_tblheader(const char *c) { "; break; case QMLEADERBOARD: - labels = "


Map List

Name
\ + labels = "
\ \ \ \ @@ -50,7 +50,7 @@ static inline void print_tblheader(const char *c) { "; break; case QRPLAYER: - labels = "


Leaderboard

Rank
\ + labels = "
\ \ \ \ @@ -98,7 +98,7 @@ static void qresult(sqlite3_stmt * const sp, const char *c) { if (ISPLAYERNAME(c, i)) { print_plname(field); } else if (ISMAPNAME(c, i)) { - printf("", field, field); + printf("", field, field); } else if (i == 2 && (*c == QMLEADERBOARD || *c == QOVERVIEW)) { print_time(field); } else { diff --git a/src/main.c b/src/main.c index ea1b5a4..0f64fd4 100644 --- a/src/main.c +++ b/src/main.c @@ -8,10 +8,7 @@ void html(void) { \ /v/ - Xonotic\ "; - const char *html_bot = "

Pages under construction.
\ - Service may sporadically become unavailable.
\ - In-game database is not directly synced with this web server.\ -

\ + const char *html_bot = "

\ "; const char *html_mid = "
\

hi / good luck and have fun.

Available Pages

\ @@ -29,7 +26,14 @@ void html(void) { printf("%s", html_bot); } +// use with template +void templated(void) { + const char *qstr = getenv("QUERY_STRING"); + getquery(qstr); + return; +} + int main(void) { - html(); + templated(); return 0; }


Ranks

Name%s%s