summaryrefslogtreecommitdiff
path: root/src/basic/strv.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-09-25 12:34:30 +0200
committerGitHub <noreply@github.com>2018-09-25 12:34:30 +0200
commit7c428bb5d57ff1517719d87a56d0489bf1f26261 (patch)
tree924950cffc37baf7376f972cb629305183bb1a35 /src/basic/strv.c
parent9afd5740391980fee5d89888fb206aed55fbaed7 (diff)
parentd491e65e74a92898d6e7f95032b5b037c6e3cb60 (diff)
downloadsystemd-7c428bb5d57ff1517719d87a56d0489bf1f26261.tar.gz
Merge pull request #10059 from yuwata/env-exec-directory
core: introduce $RUNTIME_DIRECTORY= or friends
Diffstat (limited to 'src/basic/strv.c')
-rw-r--r--src/basic/strv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c
index f7741d1878..dc72f036ac 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -339,21 +339,22 @@ int strv_split_extract(char ***t, const char *s, const char *separators, Extract
return (int) n;
}
-char *strv_join(char **l, const char *separator) {
+char *strv_join_prefix(char **l, const char *separator, const char *prefix) {
char *r, *e;
char **s;
- size_t n, k;
+ size_t n, k, m;
if (!separator)
separator = " ";
k = strlen(separator);
+ m = strlen_ptr(prefix);
n = 0;
STRV_FOREACH(s, l) {
if (s != l)
n += k;
- n += strlen(*s);
+ n += m + strlen(*s);
}
r = new(char, n+1);
@@ -365,6 +366,9 @@ char *strv_join(char **l, const char *separator) {
if (s != l)
e = stpcpy(e, separator);
+ if (prefix)
+ e = stpcpy(e, prefix);
+
e = stpcpy(e, *s);
}