make directory listing a run-time flag

remove const in the config.h since it can be changed at run-time now.
This commit is contained in:
Hiltjo Posthuma 2017-06-27 23:17:44 +02:00 committed by Laslo Hunhold
parent 434f2b3067
commit c369738fa4
3 changed files with 14 additions and 2 deletions

View file

@ -2,7 +2,7 @@ static const char *host = "localhost";
static const char *port = "80";
static const char *servedir = ".";
static const char *docindex = "index.html";
static const int listdirs = 1;
static int listdirs = 1;
static const char *user = "nobody";
static const char *group = "nogroup";
static const int maxnprocs = 512;

View file

@ -15,6 +15,8 @@
.Op Fl U Ar udsocket
.Oc
.Op Fl d Ar dir
.Op Fl l
.Op Fl L
.Op Fl u Ar user
.Op Fl g Ar group
.Sh DESCRIPTION
@ -27,6 +29,10 @@ UNIX-domain sockets.
Serve
.Ar dir
after chrooting into it.
.It Fl l
Disable directory listing.
.It Fl L
Enable directory listing.
.It Fl g Ar group
Set group ID to the ID of
.Ar group

View file

@ -857,7 +857,7 @@ static void
usage(void)
{
die("usage: %s [-v] [[[-h host] [-p port]] | [-U udsocket]] "
"[-d dir] [-u user] [-g group]\n", argv0);
"[-d dir] [-l] [-L] [-u user] [-g group]\n", argv0);
}
int
@ -879,6 +879,12 @@ main(int argc, char *argv[])
case 'h':
host = EARGF(usage());
break;
case 'l':
listdirs = 0;
break;
case 'L':
listdirs = 1;
break;
case 'p':
port = EARGF(usage());
break;