aboutsummaryrefslogtreecommitdiffstats
path: root/src/argparser.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-08-18 21:24:09 +0200
committerMattias Andrée <maandree@operamail.com>2013-08-18 21:24:15 +0200
commit00dd8fe3d265a2c210b24add1593e3328c58ab25 (patch)
tree95947eb097d9e119c3459aa7b19112ad1139cf4e /src/argparser.h
parentissue 4, java version (diff)
downloadargparser-00dd8fe3d265a2c210b24add1593e3328c58ab25.tar.gz
argparser-00dd8fe3d265a2c210b24add1593e3328c58ab25.tar.bz2
argparser-00dd8fe3d265a2c210b24add1593e3328c58ab25.tar.xz
Half of the work for issue 4, c version
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/argparser.h')
-rw-r--r--src/argparser.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/argparser.h b/src/argparser.h
index a2fff4e..41040ad 100644
--- a/src/argparser.h
+++ b/src/argparser.h
@@ -57,6 +57,23 @@ typedef struct
*/
char* help;
+ /**
+ * Invoked when the option is used
+ *
+ * @param The used option alternative
+ * @param The standard option alternative
+ */
+ void (*trigger)(char*, char*);
+
+ /**
+ * Invoked when the option is used
+ *
+ * @param The used option alternative
+ * @param The standard option alternative
+ * @param The used value
+ */
+ void (*triggerv)(char*, char*, char*);
+
} args_Option;
@@ -187,31 +204,34 @@ extern void args_dispose(void);
/**
* Creates, but does not add, a option that takes no arguments
*
+ * @param trigger Function to invoked when the option is used, with the used option and the standard option
* @param standard The index of the standard alternative name
- * @param alternatives... The alterntive names, end with `null`
+ * @param alternatives... The alternative names, end with `null`
* @return The created option
*/
-extern args_Option args_new_argumentless(int standard, char* alternatives, ...);
+extern args_Option args_new_argumentless(void (*trigger)(char*, char*), int standard, char* alternatives, ...);
/**
* Creates, but does not add, a option that takes one argument per use
*
+ * @param trigger Function to invoked when the option is used, with the used option, the standard option and the used value
* @param argument The new of the argument
* @param standard The index of the standard alternative name
- * @param alternatives... The alterntive names, end with `null`
+ * @param alternatives... The alternative names, end with `null`
* @return The created option
*/
-extern args_Option args_new_argumented(char* argument, int standard, char* alternatives, ...);
+extern args_Option args_new_argumented(void (*trigger)(char*, char*, char*), char* argument, int standard, char* alternatives, ...);
/**
* Creates, but does not add, a option that takes all following arguments
*
+ * @param trigger Function to invoked when the option is used, with the used option and the standard option
* @param argument The new of the argument
* @param standard The index of the standard alternative name
- * @param alternatives... The alterntive names, end with `null`
+ * @param alternatives... The alternative names, end with `null`
* @return The created option
*/
-extern args_Option args_new_variadic(char* argument, int standard, char* alternatives, ...);
+extern args_Option args_new_variadic(void (*trigger)(char*, char*), char* argument, int standard, char* alternatives, ...);
/**