permit prefix to be empty in -v format string - quark - quark web server
 (HTM) git clone git://git.suckless.org/quark
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit c3ddb2dd14bd7a39dedbbf3520c9a2052dd3e1ff
 (DIR) parent 69bb7710eb9bcc73dd0836b9b88228259c9586d3
 (HTM) Author: Josuah Demangeon <mail@josuah.net>
       Date:   Mon,  2 Apr 2018 02:55:00 +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.
       
       Diffstat:
         M main.c                              |       8 +++++---
         M quark.1                             |       2 +-
       
       2 files changed, 6 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git 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;
 (DIR) diff --git 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