mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-02 05:12:02 +00:00
[common] option: add support for renamed options
This commit is contained in:
@@ -48,6 +48,11 @@ struct Option
|
|||||||
{
|
{
|
||||||
char * module;
|
char * module;
|
||||||
char * name;
|
char * name;
|
||||||
|
|
||||||
|
// for migrating to new names
|
||||||
|
char * old_module;
|
||||||
|
char * old_name;
|
||||||
|
|
||||||
char * description;
|
char * description;
|
||||||
char shortopt;
|
char shortopt;
|
||||||
bool preset;
|
bool preset;
|
||||||
|
|||||||
@@ -908,6 +908,19 @@ struct Option * option_get(const char * module, const char * name)
|
|||||||
struct Option * o = state.options[i];
|
struct Option * o = state.options[i];
|
||||||
if ((strcasecmp(o->module, module) == 0) && (strcasecmp(o->name, name) == 0))
|
if ((strcasecmp(o->module, module) == 0) && (strcasecmp(o->name, name) == 0))
|
||||||
return o;
|
return o;
|
||||||
|
|
||||||
|
// check for usage of renamed options
|
||||||
|
if (o->old_module && o->old_name &&
|
||||||
|
(strcasecmp(o->old_module, module) == 0) &&
|
||||||
|
(strcasecmp(o->old_name , name) == 0))
|
||||||
|
{
|
||||||
|
// not fatal, but be noisy
|
||||||
|
DEBUG_WARN(
|
||||||
|
"%s:%s has been renamed to %s:%s, please update your configuration",
|
||||||
|
o->old_module, o->old_name,
|
||||||
|
o->module , o->name );
|
||||||
|
return o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user