Adjusted program for static html generation
This commit is contained in:
parent
7b2120d122
commit
2c01baef1b
@ -31,7 +31,7 @@ static inline void print_tblheader(const char *c) {
|
|||||||
char *labels;
|
char *labels;
|
||||||
switch (*c) {
|
switch (*c) {
|
||||||
default:
|
default:
|
||||||
labels = "<TABLE class='center'>\
|
labels = "<TABLE class='leaderboard'>\
|
||||||
<TH class='tablename' COLSPAN='4'> <H3><BR>Map List</H3> </TH>\
|
<TH class='tablename' COLSPAN='4'> <H3><BR>Map List</H3> </TH>\
|
||||||
<TR>\
|
<TR>\
|
||||||
<TH class='columnname'>Name</TH>\
|
<TH class='columnname'>Name</TH>\
|
||||||
@ -41,7 +41,7 @@ static inline void print_tblheader(const char *c) {
|
|||||||
</TR>";
|
</TR>";
|
||||||
break;
|
break;
|
||||||
case QMLEADERBOARD:
|
case QMLEADERBOARD:
|
||||||
labels = "<TABLE class='center'>\
|
labels = "<TABLE class='leaderboard'>\
|
||||||
<TH class='tablename' COLSPAN='3'><H3><BR>Leaderboard</H3></TH>\
|
<TH class='tablename' COLSPAN='3'><H3><BR>Leaderboard</H3></TH>\
|
||||||
<TR>\
|
<TR>\
|
||||||
<TH class='columnname'>Rank</TH>\
|
<TH class='columnname'>Rank</TH>\
|
||||||
@ -50,7 +50,7 @@ static inline void print_tblheader(const char *c) {
|
|||||||
</TR>";
|
</TR>";
|
||||||
break;
|
break;
|
||||||
case QRPLAYER:
|
case QRPLAYER:
|
||||||
labels = "<TABLE class='center'>\
|
labels = "<TABLE class='leaderboard'>\
|
||||||
<TH class='tablename' COLSPAN='3'> <H3><BR>Ranks</H3> </TH>\
|
<TH class='tablename' COLSPAN='3'> <H3><BR>Ranks</H3> </TH>\
|
||||||
<TR>\
|
<TR>\
|
||||||
<TH class='columnname'>Name</TH>\
|
<TH class='columnname'>Name</TH>\
|
||||||
@ -98,7 +98,7 @@ static void qresult(sqlite3_stmt * const sp, const char *c) {
|
|||||||
if (ISPLAYERNAME(c, i)) {
|
if (ISPLAYERNAME(c, i)) {
|
||||||
print_plname(field);
|
print_plname(field);
|
||||||
} else if (ISMAPNAME(c, i)) {
|
} 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)) {
|
} else if (i == 2 && (*c == QMLEADERBOARD || *c == QOVERVIEW)) {
|
||||||
print_time(field);
|
print_time(field);
|
||||||
} else {
|
} else {
|
||||||
|
14
src/main.c
14
src/main.c
@ -8,10 +8,7 @@ void html(void) {
|
|||||||
<link rel=\"stylesheet\" type=\"text/css\" href=\"page.css\">\
|
<link rel=\"stylesheet\" type=\"text/css\" href=\"page.css\">\
|
||||||
<title>/v/ - Xonotic</title>\
|
<title>/v/ - Xonotic</title>\
|
||||||
<p class='hidden'>:-) / nice one<br></p>";
|
<p class='hidden'>:-) / nice one<br></p>";
|
||||||
const char *html_bot = "<br><br><p classname='footer'>Pages under construction.<br>\
|
const char *html_bot = "<br><br>\
|
||||||
Service may sporadically become unavailable.<br>\
|
|
||||||
In-game database is not directly synced with this web server.\
|
|
||||||
</p>\
|
|
||||||
</body></html>";
|
</body></html>";
|
||||||
const char *html_mid = "<br>\
|
const char *html_mid = "<br>\
|
||||||
<H2>hi / good luck and have fun.<br><br>Available Pages</H2>\
|
<H2>hi / good luck and have fun.<br><br>Available Pages</H2>\
|
||||||
@ -29,7 +26,14 @@ void html(void) {
|
|||||||
printf("%s", html_bot);
|
printf("%s", html_bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use with template
|
||||||
|
void templated(void) {
|
||||||
|
const char *qstr = getenv("QUERY_STRING");
|
||||||
|
getquery(qstr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
html();
|
templated();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user