Add MXS_MODULE_PARAM_QUOTEDSTRING configuration value type

A quoted string is a string enclosed in '"':s. This makes it clear
where the string begins and ends, avoiding ambiguity with whitespace.
After the config file has been loaded, the '"':s at the beginning
and at the end of the string are erased. Querying the config value
with config_get_string() will return this de-quoted value.

For example, if the config file reads 'my_string="test""', the actual
string will be 'test"'.
This commit is contained in:
Esa Korhonen
2017-05-24 12:52:44 +03:00
parent f66623c382
commit 88bf361e61
2 changed files with 23 additions and 0 deletions

View File

@ -79,6 +79,7 @@ enum mxs_module_param_type
MXS_MODULE_PARAM_SIZE, /**< Size in bytes */
MXS_MODULE_PARAM_BOOL, /**< Boolean value */
MXS_MODULE_PARAM_STRING, /**< String value */
MXS_MODULE_PARAM_QUOTEDSTRING, /**< String enclosed in '"':s */
MXS_MODULE_PARAM_ENUM, /**< Enumeration of string values */
MXS_MODULE_PARAM_PATH, /**< Path to a file or a directory */
MXS_MODULE_PARAM_SERVICE, /**< Service name */
@ -233,6 +234,8 @@ static inline const char* mxs_module_param_type_to_string(enum mxs_module_param_
return "bool";
case MXS_MODULE_PARAM_STRING:
return "string";
case MXS_MODULE_PARAM_QUOTEDSTRING:
return "quoted string";
case MXS_MODULE_PARAM_ENUM:
return "enum";
case MXS_MODULE_PARAM_PATH: