From 84b5a8f76cb7ef04ffa75c80f8ffb383abeae9cc Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 26 Jul 2012 19:28:29 -0600 Subject: [PATCH] puzzles.cgi from novar branch --- packages/00common/src/puzzles.cgi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/00common/src/puzzles.cgi.c b/packages/00common/src/puzzles.cgi.c index a8d6bd9..39403a8 100644 --- a/packages/00common/src/puzzles.cgi.c +++ b/packages/00common/src/puzzles.cgi.c @@ -94,13 +94,13 @@ main(int argc, char *argv[]) opt = opendir(package_path("")); if (NULL == opt) { - cgi_error("Cannot opendir(\"/opt\")"); + cgi_error("Cannot open packages directory"); } cgi_head("Open puzzles"); printf("
\n"); - /* For each file in /opt/ ... */ + /* For each file in /packages/ ... */ while (1) { struct dirent *e = readdir(opt); char *cat; @@ -136,6 +136,11 @@ main(int argc, char *argv[]) read_until_char(map, hash, sizeof(hash), '\n'); points = atol(points_str); + if (0 == points) { + printf(" \n"); + break; + } + printf(" %ld\n", cat, hash, points); if (points > maxpoints) break;