[hackers] [quark] permit prefix to be empty in -v format string || Josuah Demangeon

From: <git_AT_suckless.org>
Date: Mon, 2 Apr 2018 10:00:12 +0200 (CEST)

commit c3ddb2dd14bd7a39dedbbf3520c9a2052dd3e1ff
Author: Josuah Demangeon <mail_AT_josuah.net>
AuthorDate: Mon Apr 2 02:55:00 2018 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Mon Apr 2 09:57:58 2018 +0200

    permit prefix to be empty in -v format string
    
    The previous parsing of the -v vhosts made sure there were 4 tokens.
    If there was no prefix specified, usage() is called. Now, it only
    checks for the firsts 3, with .prefix set to null if there are only
    3 tokens.

diff --git a/main.c b/main.c
index 5f1c6d9..943d146 100644
--- a/main.c
+++ b/main.c
_AT_@ -172,9 +172,11 @@ main(int argc, char *argv[])
                 }
                 if (!(s.vhost[s.vhost_len - 1].chost = strtok(tok, " ")) ||
                     !(s.vhost[s.vhost_len - 1].regex = strtok(NULL, " ")) ||
- !(s.vhost[s.vhost_len - 1].dir = strtok(NULL, " ")) ||
- !(s.vhost[s.vhost_len - 1].prefix = strtok(NULL, " ")) ||
- strtok(NULL, "")) {
+ !(s.vhost[s.vhost_len - 1].dir = strtok(NULL, " "))) {
+ usage();
+ }
+ s.vhost[s.vhost_len - 1].prefix = strtok(NULL, " ");
+ if (strtok(NULL, "")) {
                         usage();
                 }
                 break;
diff --git a/quark.1 b/quark.1
index 7179a86..2d48842 100644
--- a/quark.1
+++ b/quark.1
_AT_@ -96,7 +96,7 @@ The default is "nobody".
 Add the virtual host specified by
 .Ar vhost ,
 which has the form
-.Qq Pa chost regex dir prefix ,
+.Qq Pa chost regex dir [prefix] ,
 where each element is separated with whitespace.
 .Pp
 A request matching the virtual host regular expression
Received on Mon Apr 02 2018 - 10:00:12 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 02 2018 - 10:00:44 CEST