diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-26 22:17:40 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-26 22:48:17 +0900 |
commit | 8059aa9c92fe1f9847fc33b11670d3f48ad92fb4 (patch) | |
tree | 0c6a66ae805e1bf4d6477d36d5b20c8b409b3d8c /src/basic/strv.c | |
parent | 2c3a11d86efdf54493ac18719af5aa76b0483d51 (diff) | |
download | systemd-8059aa9c92fe1f9847fc33b11670d3f48ad92fb4.tar.gz |
strv: introduce 'relax' mode to strv_split_full()
If SPLIT_RELAX is specified, then it accepts unfinished quotes or
missing separator after right quote.
Diffstat (limited to 'src/basic/strv.c')
-rw-r--r-- | src/basic/strv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c index 0647a472d7..1bab723e88 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_full(const char *s, const char *separator, bool quoted) { +char **strv_split_full(const char *s, const char *separator, SplitFlags flags) { const char *word, *state; size_t l; size_t n, i; @@ -261,7 +261,7 @@ char **strv_split_full(const char *s, const char *separator, bool quoted) { return new0(char*, 1); n = 0; - _FOREACH_WORD(word, l, s, separator, quoted, state) + _FOREACH_WORD(word, l, s, separator, flags, state) n++; r = new(char*, n+1); @@ -269,7 +269,7 @@ char **strv_split_full(const char *s, const char *separator, bool quoted) { return NULL; i = 0; - _FOREACH_WORD(word, l, s, separator, quoted, state) { + _FOREACH_WORD(word, l, s, separator, flags, state) { r[i] = strndup(word, l); if (!r[i]) { strv_free(r); |