[hackers] [quark][PATCH 2/3] permit prefix to be empty in -v format string

From: Josuah Demangeon <mail_AT_josuah.net>
Date: Mon, 2 Apr 2018 02:55:00 +0200

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.
---
 main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
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;
-- 
2.10.0
Received on Mon Apr 02 2018 - 02:55:00 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 02 2018 - 03:00:32 CEST