puzzles.cgi from novar branch

This commit is contained in:
Neale Pickett 2012-07-26 19:28:29 -06:00
parent 5f133fe753
commit 009578a3f6
1 changed files with 7 additions and 2 deletions

View File

@ -94,13 +94,13 @@ main(int argc, char *argv[])
opt = opendir(package_path("")); opt = opendir(package_path(""));
if (NULL == opt) { if (NULL == opt) {
cgi_error("Cannot opendir(\"/opt\")"); cgi_error("Cannot open packages directory");
} }
cgi_head("Open puzzles"); cgi_head("Open puzzles");
printf("<dl>\n"); printf("<dl>\n");
/* For each file in /opt/ ... */ /* For each file in /packages/ ... */
while (1) { while (1) {
struct dirent *e = readdir(opt); struct dirent *e = readdir(opt);
char *cat; char *cat;
@ -136,6 +136,11 @@ main(int argc, char *argv[])
read_until_char(map, hash, sizeof(hash), '\n'); read_until_char(map, hash, sizeof(hash), '\n');
points = atol(points_str); points = atol(points_str);
if (0 == points) {
printf(" <span title=\"Category Complete\">⁂</span>\n");
break;
}
printf(" <a href=\"/%s/%s/\">%ld</a>\n", cat, hash, points); printf(" <a href=\"/%s/%s/\">%ld</a>\n", cat, hash, points);
if (points > maxpoints) break; if (points > maxpoints) break;