'configure' apparently doesn't bump the timestamp on config.h if it
[sgt/agedu] / agedu.c
diff --git a/agedu.c b/agedu.c
index 1d77408..afaa556 100644 (file)
--- a/agedu.c
+++ b/agedu.c
@@ -341,6 +341,8 @@ static void text_query(const void *mappedfile, const char *querydir,
         HELPOPT("[--scan,--load] keep real atimes on directories") \
     NOVAL(NODIRATIME) LONG(no_dir_atime) LONG(no_dir_atimes) \
         HELPOPT("[--scan,--load] fake atimes on directories") \
+    NOVAL(NOEOF) LONG(no_eof) LONG(noeof) \
+        HELPOPT("[--web] do not close web server on EOF") \
     NOVAL(MTIME) LONG(mtime) \
         HELPOPT("[--scan] use mtime instead of atime") \
     NOVAL(SHOWFILES) LONG(files) \
@@ -393,8 +395,8 @@ enum { OPTIONS(IGNORE,IGNORE,IGNORE,LONGTMP) NLONGOPTS };
 static const int opthasval[NOPTIONS] = {OPTIONS(ZERO,ONE,IGNORE,IGNORE)};
 static const char shortopts[] = {OPTIONS(IGNORE,IGNORE,STRINGNOCOMMA,IGNORE)};
 static const char *const longopts[] = {OPTIONS(IGNORE,IGNORE,IGNORE,STRING)};
-enum { OPTIONS(SHORTNEWOPT,SHORTNEWOPT,SHORTTHISOPT,IGNORE) };
-enum { OPTIONS(LONGNEWOPT,LONGNEWOPT,IGNORE,LONGTHISOPT) };
+enum { OPTIONS(SHORTNEWOPT,SHORTNEWOPT,SHORTTHISOPT,IGNORE) UNUSEDENUMVAL1 };
+enum { OPTIONS(LONGNEWOPT,LONGNEWOPT,IGNORE,LONGTHISOPT) UNUSEDENUMVAL2 };
 static const int shortvals[] = {OPTIONS(IGNORE,IGNORE,SHORTOPTVAL,IGNORE)};
 static const int longvals[] = {OPTIONS(IGNORE,IGNORE,IGNORE,LONGOPTVAL)};
 
@@ -510,6 +512,7 @@ int main(int argc, char **argv)
     int depth = -1, gotdepth = 0;
     int fakediratimes = 1;
     int mtime = 0;
+    int closeoneof = 1;
     int showfiles = 0;
 
 #ifdef DEBUG_MAD_OPTION_PARSING_MACROS
@@ -664,8 +667,6 @@ int main(int argc, char **argv)
 
                        for (i = 0; licence[i]; i++)
                            fputs(licence[i], stdout);
-
-                       return 0;
                    }
                    return 0;
                  case OPT_SCAN:
@@ -769,6 +770,9 @@ int main(int argc, char **argv)
                  case OPT_MTIME:
                    mtime = 1;
                    break;
+                  case OPT_NOEOF:
+                    closeoneof = 0;
+                    break;
                  case OPT_DATAFILE:
                    filename = optval;
                    break;
@@ -1133,6 +1137,7 @@ int main(int argc, char **argv)
                prevbuf[0] = '\0';
                tf = triewalk_next(tw, buf);
                assert(tf);
+               prevtf = NULL;         /* placate lint */
                while (1) {
                    int i;
 
@@ -1414,7 +1419,7 @@ int main(int argc, char **argv)
                           "<html><head>"
                           "<title>404 Not Found</title>"
                           "</head><body>"
-                          "<h1>400 Not Found</h1>"
+                          "<h1>404 Not Found</h1>"
                           "<p>This is not a valid pathname index."
                           "</body></html>\n");
                    return 0;
@@ -1590,6 +1595,7 @@ int main(int argc, char **argv)
 
            dcfg.address = httpserveraddr;
            dcfg.port = httpserverport;
+           dcfg.closeoneof = closeoneof;
            dcfg.basicauthdata = httpauthdata;
            pcfg.format = NULL;
            pcfg.rootpage = NULL;