summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2012-03-18 15:52:02 -0700
committerGeoff Levand <geoff@infradead.org>2012-03-18 15:52:02 -0700
commit59c55e2b636c0f877d36dbd158ede80a6dbf7ae3 (patch)
tree7fa8d2f094c615db2a20d97b3073181789fe31d2
parentb53c175d61e9cac8e5a95abee9d6c05032d284b5 (diff)
downloadtalos-petitboot-59c55e2b636c0f877d36dbd158ede80a6dbf7ae3.tar.gz
talos-petitboot-59c55e2b636c0f877d36dbd158ede80a6dbf7ae3.zip
Add parser routine conf_replace_char()
Signed-off-by: Geoff Levand <geoff@infradead.org>
-rw-r--r--discover/parser-conf.c16
-rw-r--r--discover/parser-conf.h1
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
OpenPOWER on IntegriCloud