summaryrefslogtreecommitdiff
path: root/cmdutils.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-08-28 14:43:54 +0200
committerAnton Khirnov <anton@khirnov.net>2011-09-04 13:12:00 +0200
commit7cc8d6385aaf1005700305f21d5d56b51b38c537 (patch)
tree73aff2665f8eef3fb60f7babe7403692f3d67b0f /cmdutils.h
parent7efe05ab298ae18437c9796f43b9f47474763a39 (diff)
cmdutils: add support for caller-provided option context.
This is the first step to removing the globals plague from avtools.
Diffstat (limited to 'cmdutils.h')
-rw-r--r--cmdutils.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/cmdutils.h b/cmdutils.h
index e72c730fa7..a4716cad61 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -124,9 +124,13 @@ typedef struct {
#define OPT_INT64 0x0400
#define OPT_EXIT 0x0800
#define OPT_DATA 0x1000
+#define OPT_FUNC2 0x2000
+#define OPT_OFFSET 0x4000 /* option is specified as an offset in a passed optctx */
union {
void *dst_ptr;
int (*func_arg)(const char *, const char *);
+ int (*func2_arg)(void *, const char *, const char *);
+ size_t off;
} u;
const char *help;
const char *argname;
@@ -136,14 +140,16 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, int
/**
* Parse the command line arguments.
+ *
+ * @param optctx an opaque options context
* @param options Array with the definitions required to interpret every
* option of the form: -option_name [argument]
* @param parse_arg_function Name of the function called to process every
* argument without a leading option name flag. NULL if such arguments do
* not have to be processed.
*/
-void parse_options(int argc, char **argv, const OptionDef *options,
- void (* parse_arg_function)(const char*));
+void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
+ void (* parse_arg_function)(void *optctx, const char*));
/**
* Check if the given stream matches a stream specifier.