From 53389e24b688f8eb4e63db4714cf1d00916d603a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 26 Aug 2013 13:38:50 +0200 Subject: c fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/argparser.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/argparser.c') diff --git a/src/argparser.c b/src/argparser.c index 28670e3..644f6fd 100644 --- a/src/argparser.c +++ b/src/argparser.c @@ -749,6 +749,18 @@ void args_optmap_trigger(char* name, char* value) opt->triggerv(name, opt->standard, value); } +/** + * Trigger an option + * + * @param name The option's alternative name + * @param value The use value + */ +void args_optmap_triggerv(char* name, char* value) +{ + args_Option* opt = args_options + args_optmap_get_index(name); + opt->triggerv(name, opt->standard, value); +} + /** * Evaluate if an argument can be used without being sticky for an optionally argument option * @@ -1333,10 +1345,10 @@ long args_parse(int argc, char** argv) char* arg_opt = *(optqueue + optptr - get--); long passed = true; if (args_optmap_get_type(arg_opt) == OPTARGUMENTED) - if (args_optmap_stickless(arg_opt, arg)) + if (args_optmap_stickless(arg_opt, arg) == false) { passed = false; - args_optmap_trigger(arg_opt, null); + args_optmap_triggerv(arg_opt, null); *(argqueue + argptr++) = null; } if (passed) @@ -1487,7 +1499,7 @@ long args_parse(int argc, char** argv) char* opt = args_optmap_get_standard(*(optqueue + i)); char* arg = argptr > i ? *(argqueue + i) : null; if (argptr <= i) - args_optmap_trigger(opt, null); + args_optmap_triggerv(opt, null); i++; if ((args_optmap_contains(opt) == false) || (args_opts_contains(opt) == false)) args_opts_new(opt); -- cgit v1.2.3-70-g09d2