aboutsummaryrefslogtreecommitdiffstats
path: root/src/argparser.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-08-26 13:38:50 +0200
committerMattias Andrée <maandree@operamail.com>2013-08-26 13:38:50 +0200
commit53389e24b688f8eb4e63db4714cf1d00916d603a (patch)
tree3f4090d56028f297b26dd503f4880a2a2e8f66e1 /src/argparser.c
parentc fix (diff)
downloadargparser-53389e24b688f8eb4e63db4714cf1d00916d603a.tar.gz
argparser-53389e24b688f8eb4e63db4714cf1d00916d603a.tar.bz2
argparser-53389e24b688f8eb4e63db4714cf1d00916d603a.tar.xz
c fix
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/argparser.c18
1 files changed, 15 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
@@ -750,6 +750,18 @@ 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)
+{
+ 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
*
* @param name The option's alternative name
@@ -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);