]> git.ozlabs.org Git - petitboot/blobdiff - discover/parser-conf.c
Add parser routine conf_replace_char()
[petitboot] / discover / parser-conf.c
index 88e96b7bee9e149d8e0cc58f93a156b9779c7193..6926a92a3fc3b836f51353ec71d3f9b920c43812 100644 (file)
@@ -57,6 +57,22 @@ char *conf_strip_str(char *s)
        return strlen(s) ? s : NULL;
 }
 
+/**
+ * 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.