commit c369738fa4aa427d7e43e423917f5479970c6686
Author:     Hiltjo Posthuma <[email protected]>
AuthorDate: Tue Jun 27 23:17:44 2017 +0200
Commit:     Laslo Hunhold <[email protected]>
CommitDate: Tue Jun 27 23:31:08 2017 +0200

    make directory listing a run-time flag
    
    remove const in the config.h since it can be changed at run-time now.

diff --git a/config.def.h b/config.def.h
index d3e4206..863add9 100644
--- 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
index e486bb8..f95d199 100644
--- 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
index 8f1a91b..3c80be1 100644
--- 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;

Reply via email to