summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/options.c
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2010-07-21 13:28:42 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2010-07-21 13:28:42 +0000
commitfcd17cc3aff2e08bd8e1ffe5183e5768f2635eae (patch)
tree30a3908a317b674b4a780ca3f81c2680ad7b86e0 /src/lib/util/options.c
parent6cc37700c845db2c9725e9d3972b132095cc9883 (diff)
- Added new operation on options which enables adding of parameter and executing it's callback
- Updated parse_ini_file so before INI is loaded set of driver name is done, and therefore needed callback is executed. This fixes issue that when running MESS you are able to mount images even if you did not start driver directly, before this change we got unknown ini options warnings. (no whatsnew)
Diffstat (limited to 'src/lib/util/options.c')
-rw-r--r--src/lib/util/options.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/util/options.c b/src/lib/util/options.c
index cab6714ac7d..72fdfb8839a 100644
--- a/src/lib/util/options.c
+++ b/src/lib/util/options.c
@@ -495,6 +495,30 @@ int options_parse_command_line(core_options *opts, int argc, char **argv, int pr
/*-------------------------------------------------
+ options_force_option_callback - set option value
+ and execute callback call
+-------------------------------------------------*/
+
+int options_force_option_callback(core_options *opts, const char *optionname, const char *newval, int priority)
+{
+ options_data *data = find_entry_data(opts, optionname, TRUE);
+ if (data == NULL)
+ {
+ message(opts, OPTMSG_ERROR, "Error: unknown option: %s\n", optionname);
+ return 1;
+ }
+
+ /* invoke callback, if present */
+ if (data->callback != NULL)
+ (*data->callback)(opts, newval);
+
+ /* allocate a new copy of data for this */
+ update_data(opts, data, newval, priority);
+ return 0;
+}
+
+
+/*-------------------------------------------------
options_parse_ini_file - parse a series
of entries in an INI file
-------------------------------------------------*/