. TODO: dir entries -> dir listings

. TODO: minor cleanup
. --help as first parameter results in usage()
This commit is contained in:
Emil Mikulic 2003-03-07 08:25:04 +00:00
parent 7c29be2b7d
commit d6b7871ade

View File

@ -11,16 +11,16 @@
* TODO: * TODO:
* x Ignore SIGPIPE. * x Ignore SIGPIPE.
* x Actually serve files. * x Actually serve files.
* . Generate directory entries. * . Generate directory listings.
* x Log to file. * x Log to file.
* . Partial content. * . Partial content.
* . If-Modified-Since. * . If-Modified-Since.
* . Keep-alive connections. * . Keep-alive connections.
* . Chroot, set{uid|gid}. * . Chroot, set{uid|gid}.
* . Port to Win32. * . Port to Win32.
* . Content-Type * . Detect Content-Type from a list of content types.
* x Log Referer, User-Agent * x Log Referer, User-Agent.
* . Ensure URIs requested are safe * . Ensure URIs requested are safe.
*/ */
#include <sys/types.h> #include <sys/types.h>
@ -244,10 +244,14 @@ static void parse_commandline(const int argc, char *argv[])
{ {
int i; int i;
if (argc < 2) usage(); /* no wwwroot given */ if (
wwwroot = expand_tilde( argv[1] ); /* ~/public_html/ */ (argc < 2) ||
(argc == 2 && strcmp(argv[1], "--help") == 0)
)
usage(); /* no wwwroot given */
wwwroot = expand_tilde( argv[1] ); /* ~/html -> /home/user/html */
strip_endslash(&wwwroot); strip_endslash(&wwwroot);
debugf("wwwroot = ``%s''\n", wwwroot);
/* walk through the remainder of the arguments (if any) */ /* walk through the remainder of the arguments (if any) */
for (i=2; i<argc; i++) for (i=2; i<argc; i++)