diff options
Diffstat (limited to 'discover')
-rw-r--r-- | discover/parser-conf.c | 16 | ||||
-rw-r--r-- | discover/parser-conf.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/discover/parser-conf.c b/discover/parser-conf.c index 88e96b7..6926a92 100644 --- a/discover/parser-conf.c +++ b/discover/parser-conf.c @@ -58,6 +58,22 @@ char *conf_strip_str(char *s) } /** + * conf_replace_char - replace one char with another. + */ + +char *conf_replace_char(char *s, char from, char to) +{ + if (!s) + return NULL; + + for ( ; *s; s++) + if (*s == from) + *s = to; + + return s; +} + +/** * conf_get_param_pair - Get the next 'name=value' parameter pair. * @str: The string to process. * @name_out: Returns a pointer to the name. diff --git a/discover/parser-conf.h b/discover/parser-conf.h index 3325faf..66013f3 100644 --- a/discover/parser-conf.h +++ b/discover/parser-conf.h @@ -51,5 +51,6 @@ int conf_set_global_option(struct conf_context *conf, const char *name, int conf_param_in_list(const char *const *list, const char *param); char *conf_strip_str(char *s); +char *conf_replace_char(char *s, char from, char to); #endif |