commit c369738fa4aa427d7e43e423917f5479970c6686
parent 434f2b3067e759cf55b52da1a73f89c2ebb133cb
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 27 Jun 2017 23:17:44 +0200
make directory listing a run-time flag
remove const in the config.h since it can be changed at run-time now.
Diffstat:
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -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;
diff --git a/quark.1 b/quark.1
@@ -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
diff --git a/quark.c b/quark.c
@@ -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;