an option to the web server mode, to inhibit it from trying to read
stdin and treating EOF there as a cue to shut down.
git-svn-id: svn://svn.tartarus.org/sgt/agedu@9036
cda61777-01e9-0310-a592-
d414129be87e
-The web server runs until \cw{agedu} receives an end-of-file event
-on its standard input. (The expected usage is that you run it from
-the command line, immediately browse web pages until you're
-satisfied, and then press Ctrl-D.)
+The web server runs until \cw{agedu} receives an end-of-file event on
+its standard input. (The expected usage is that you run it from the
+command line, immediately browse web pages until you're satisfied, and
+then press Ctrl-D.) To disable the EOF behaviour, use the
+\cw{--no-eof} option.
In case the index file contains any confidential information about
your file system, the web server protects the pages it serves from
In case the index file contains any confidential information about
your file system, the web server protects the pages it serves from
password, followed \e{immediately} by end of file (no trailing
newline, or else it will be considered part of the password).
password, followed \e{immediately} by end of file (no trailing
newline, or else it will be considered part of the password).
+\dt \cw{--no-eof}
+
+\dd Stop \cw{agedu} in web server mode from looking for end-of-file on
+standard input and treating it as a signal to terminate.
+
\U LIMITATIONS
The data file is pretty large. The core of \cw{agedu} is the
\U LIMITATIONS
The data file is pretty large. The core of \cw{agedu} is the
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") \
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) \
NOVAL(MTIME) LONG(mtime) \
HELPOPT("[--scan] use mtime instead of atime") \
NOVAL(SHOWFILES) LONG(files) \
int depth = -1, gotdepth = 0;
int fakediratimes = 1;
int mtime = 0;
int depth = -1, gotdepth = 0;
int fakediratimes = 1;
int mtime = 0;
int showfiles = 0;
#ifdef DEBUG_MAD_OPTION_PARSING_MACROS
int showfiles = 0;
#ifdef DEBUG_MAD_OPTION_PARSING_MACROS
case OPT_MTIME:
mtime = 1;
break;
case OPT_MTIME:
mtime = 1;
break;
+ case OPT_NOEOF:
+ closeoneof = 0;
+ break;
case OPT_DATAFILE:
filename = optval;
break;
case OPT_DATAFILE:
filename = optval;
break;
dcfg.address = httpserveraddr;
dcfg.port = httpserverport;
dcfg.address = httpserveraddr;
dcfg.port = httpserverport;
+ dcfg.closeoneof = closeoneof;
dcfg.basicauthdata = httpauthdata;
pcfg.format = NULL;
pcfg.rootpage = NULL;
dcfg.basicauthdata = httpauthdata;
pcfg.format = NULL;
pcfg.rootpage = NULL;
printf("URL: http://%s:%d/\n",
inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
}
printf("URL: http://%s:%d/\n",
inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
}
/*
* Now construct an fd structure to hold it.
*/
new_fdstruct(fd, FD_LISTENER);
/*
* Now construct an fd structure to hold it.
*/
new_fdstruct(fd, FD_LISTENER);
- /*
- * Read from standard input, and treat EOF as a notification
- * to exit.
- */
- new_fdstruct(0, FD_CLIENT);
+ if (dcfg->closeoneof) {
+ /*
+ * Read from standard input, and treat EOF as a notification
+ * to exit.
+ */
+ new_fdstruct(0, FD_CLIENT);
+ }
/*
* Now we're ready to run our main loop. Keep looping round on
/*
* Now we're ready to run our main loop. Keep looping round on
struct httpd_config {
const char *address;
int port;
struct httpd_config {
const char *address;
int port;
const char *basicauthdata;
};
const char *basicauthdata;
};