commit c3ddb2dd14bd7a39dedbbf3520c9a2052dd3e1ff
Author:     Josuah Demangeon <[email protected]>
AuthorDate: Mon Apr 2 02:55:00 2018 +0200
Commit:     Laslo Hunhold <[email protected]>
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
@@ -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
@@ -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

Reply via email to