fen.c: CGI mode: write output header before play moves - chess-puzzles - chess … | |
git clone git://git.codemadness.org/chess-puzzles | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit da65c61271ad6e8eb3fde5a8e828ed4d2c882fb2 | |
parent 2037128c8c5a1527bddad29041660177a1cee999 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Mon, 8 Jan 2024 21:36:42 +0100 | |
fen.c: CGI mode: write output header before play moves | |
... else PGN output will be before the header is written. | |
Diffstat: | |
M fen.c | 5 ++++- | |
1 file changed, 4 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/fen.c b/fen.c | |
@@ -1549,8 +1549,9 @@ cgi_mode(void) | |
if ((p = getparam(query, "moves"))) { | |
if (decodeparam(buf, sizeof(buf), p) == -1) | |
goto badrequest; | |
- board_playmoves(&board, buf); | |
} | |
+ if (!p) | |
+ buf[0] = '\0'; | |
fputs("Status: 200 OK\r\n", stdout); | |
if (outputmode == ModeSVG) | |
@@ -1558,6 +1559,8 @@ cgi_mode(void) | |
else | |
fputs("Content-Type: text/plain\r\n\r\n", stdout); | |
+ board_playmoves(&board, buf); | |
+ | |
output(&board); | |
return 0; |