This is to strv_split_quoted as unescape_first_word is to
unquote_first_word.
---
 src/shared/strv.c | 8 ++++++--
 src/shared/strv.h | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/shared/strv.c b/src/shared/strv.c
index d44a72f..a6c42d4 100644
--- a/src/shared/strv.c
+++ b/src/shared/strv.c
@@ -278,7 +278,7 @@ char **strv_split_newlines(const char *s) {
         return l;
 }
 
-int strv_split_quoted(char ***t, const char *s, UnquoteFlags flags) {
+int strv_split_escaped(char ***t, const char *s, const char *separators, 
UnquoteFlags flags) {
         size_t n = 0, allocated = 0;
         _cleanup_strv_free_ char **l = NULL;
         int r;
@@ -289,7 +289,7 @@ int strv_split_quoted(char ***t, const char *s, 
UnquoteFlags flags) {
         for (;;) {
                 _cleanup_free_ char *word = NULL;
 
-                r = unquote_first_word(&s, &word, flags);
+                r = unescape_first_word(&s, &word, separators, flags);
                 if (r < 0)
                         return r;
                 if (r == 0)
@@ -313,6 +313,10 @@ int strv_split_quoted(char ***t, const char *s, 
UnquoteFlags flags) {
         return 0;
 }
 
+int strv_split_quoted(char ***t, const char *s, UnquoteFlags flags) {
+        return strv_split_escaped(t, s, WHITESPACE, flags|UNQUOTE_QUOTES);
+}
+
 char *strv_join(char **l, const char *separator) {
         char *r, *e;
         char **s;
diff --git a/src/shared/strv.h b/src/shared/strv.h
index 22f8f98..edde2e4 100644
--- a/src/shared/strv.h
+++ b/src/shared/strv.h
@@ -73,6 +73,7 @@ static inline bool strv_isempty(char * const *l) {
 char **strv_split(const char *s, const char *separator);
 char **strv_split_newlines(const char *s);
 
+int strv_split_escaped(char ***t, const char *s, const char *separators, 
UnquoteFlags flags);
 int strv_split_quoted(char ***t, const char *s, UnquoteFlags flags);
 
 char *strv_join(char **l, const char *separator);
-- 
1.9.1

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to