[hackers] [quark] make directory listing a run-time flag || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Tue, 27 Jun 2017 23:31:29 +0200 (CEST)

commit c369738fa4aa427d7e43e423917f5479970c6686
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Tue Jun 27 23:17:44 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
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
_AT_@ -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
_AT_@ -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
_AT_@ -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
_AT_@ -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
_AT_@ -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;
Received on Tue Jun 27 2017 - 23:31:29 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 27 2017 - 23:37:17 CEST