summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2010-11-12 14:42:46 +0100
committerSven Verdoolaege <skimo@kotnet.org>2010-11-12 16:10:17 +0100
commit2897182459dbb129c30723d7c7a92cd0a24da565 (patch)
tree74f330001987b6767487ddddb01c68ed27b9520f
parent07edb4c5fec4fdde3b726bf11ac4df85d1a45614 (diff)
downloadisl-2897182459dbb129c30723d7c7a92cd0a24da565.tar.gz
isl-2897182459dbb129c30723d7c7a92cd0a24da565.tar.bz2
isl-2897182459dbb129c30723d7c7a92cd0a24da565.zip
isl_options_parse: accept prefix before or after "no" on boolean options
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
-rw-r--r--isl_arg.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/isl_arg.c b/isl_arg.c
index 17c67ffd..4b94f5fd 100644
--- a/isl_arg.c
+++ b/isl_arg.c
@@ -599,9 +599,22 @@ static int parse_bool_option(struct isl_arg *decl, const char *arg,
return 1;
}
- if (strncmp(arg, "--no-", 5))
+ if (strncmp(arg, "--", 2))
+ return 0;
+ arg += 2;
+
+ if (prefix) {
+ size_t prefix_len = strlen(prefix);
+ if (strncmp(arg, prefix, prefix_len) == 0 &&
+ arg[prefix_len] == '-') {
+ arg += prefix_len + 1;
+ prefix = NULL;
+ }
+ }
+
+ if (strncmp(arg, "no-", 3))
return 0;
- arg += 5;
+ arg += 3;
if (prefix) {
size_t prefix_len = strlen(prefix);