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 +++++++++++++++--- src/argparser.h | 8 ++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) 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); diff --git a/src/argparser.h b/src/argparser.h index 7cc82b2..3c06584 100644 --- a/src/argparser.h +++ b/src/argparser.h @@ -329,6 +329,14 @@ extern char* args_options_get_standard(long index); */ void args_optmap_trigger(char* name, char* value); +/** + * Trigger an option + * + * @param name The option's alternative name + * @param value The use value + */ +void args_optmap_triggerv(char* name, char* value); + /** * Evaluate if an argument can be used without being sticky for an optionally argument option * -- cgit v1.2.3-70-g09d2