Adjusted program for static html generation

This commit is contained in:
- 2022-02-08 19:31:34 -08:00
parent 7b2120d122
commit 2c01baef1b
2 changed files with 13 additions and 9 deletions

View File

@ -31,7 +31,7 @@ static inline void print_tblheader(const char *c) {
char *labels;
switch (*c) {
default:
labels = "<TABLE class='center'>\
labels = "<TABLE class='leaderboard'>\
<TH class='tablename' COLSPAN='4'> <H3><BR>Map List</H3> </TH>\
<TR>\
<TH class='columnname'>Name</TH>\
@ -41,7 +41,7 @@ static inline void print_tblheader(const char *c) {
</TR>";
break;
case QMLEADERBOARD:
labels = "<TABLE class='center'>\
labels = "<TABLE class='leaderboard'>\
<TH class='tablename' COLSPAN='3'><H3><BR>Leaderboard</H3></TH>\
<TR>\
<TH class='columnname'>Rank</TH>\
@ -50,7 +50,7 @@ static inline void print_tblheader(const char *c) {
</TR>";
break;
case QRPLAYER:
labels = "<TABLE class='center'>\
labels = "<TABLE class='leaderboard'>\
<TH class='tablename' COLSPAN='3'> <H3><BR>Ranks</H3> </TH>\
<TR>\
<TH class='columnname'>Name</TH>\
@ -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("<TD><a href='/cgi/cts?map=%s'>%s</a></TD>", field, field);
printf("<TD><a href='./%s.html'>%s</a></TD>", field, field);
} else if (i == 2 && (*c == QMLEADERBOARD || *c == QOVERVIEW)) {
print_time(field);
} else {

View File

@ -8,10 +8,7 @@ void html(void) {
<link rel=\"stylesheet\" type=\"text/css\" href=\"page.css\">\
<title>/v/ - Xonotic</title>\
<p class='hidden'>:-) / nice one<br></p>";
const char *html_bot = "<br><br><p classname='footer'>Pages under construction.<br>\
Service may sporadically become unavailable.<br>\
In-game database is not directly synced with this web server.\
</p>\
const char *html_bot = "<br><br>\
</body></html>";
const char *html_mid = "<br>\
<H2>hi / good luck and have fun.<br><br>Available Pages</H2>\
@ -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;
}