summaryrefslogtreecommitdiff
path: root/src/basic/strv.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-09-26 19:17:51 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-09-26 19:17:51 +0900
commitaf0b60b37c8bc5e5206d41e00f31f2682a51f21e (patch)
tree503776b6ae57c09935036e6c145acf25b43b2bad /src/basic/strv.c
parent0fbc35524c6990b3295e625a90a7fd8c5a619058 (diff)
downloadsystemd-af0b60b37c8bc5e5206d41e00f31f2682a51f21e.tar.gz
strv: introduce strv_split_full() which optionally handle quotes
Diffstat (limited to 'src/basic/strv.c')
-rw-r--r--src/basic/strv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c
index dc72f036ac..ffc7b98d70 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -245,7 +245,7 @@ int strv_extend_strv_concat(char ***a, char **b, const char *suffix) {
return 0;
}
-char **strv_split(const char *s, const char *separator) {
+char **strv_split_full(const char *s, const char *separator, bool quoted) {
const char *word, *state;
size_t l;
size_t n, i;
@@ -258,7 +258,7 @@ char **strv_split(const char *s, const char *separator) {
return new0(char*, 1);
n = 0;
- FOREACH_WORD_SEPARATOR(word, l, s, separator, state)
+ _FOREACH_WORD(word, l, s, separator, quoted, state)
n++;
r = new(char*, n+1);
@@ -266,7 +266,7 @@ char **strv_split(const char *s, const char *separator) {
return NULL;
i = 0;
- FOREACH_WORD_SEPARATOR(word, l, s, separator, state) {
+ _FOREACH_WORD(word, l, s, separator, quoted, state) {
r[i] = strndup(word, l);
if (!r[i]) {
strv_free(r);