summaryrefslogtreecommitdiff
path: root/src/basic/strv.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2016-01-26 18:07:19 +0100
committerTom Gundersen <teg@jklm.no>2016-01-26 18:07:19 +0100
commitcfd77192c1de3bd264d15d6f4d8b3117f5619f4f (patch)
tree2534573f6826eac1ed2bdebfbff27ac07609cf44 /src/basic/strv.c
parent3820ed90335211dc208b048f1ff48ae66940ce3b (diff)
parent4850d39ab72e7cb00a6e9c9aa4745c997674efa6 (diff)
Merge pull request #2437 from poettering/dnssec19
nineteenth dnssec patch
Diffstat (limited to 'src/basic/strv.c')
-rw-r--r--src/basic/strv.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c
index 0a3d15706f..5532c53ad1 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -29,6 +29,7 @@
#include "alloc-util.h"
#include "escape.h"
#include "extract-word.h"
+#include "fileio.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
@@ -871,3 +872,22 @@ rollback:
nl[k] = NULL;
return -ENOMEM;
}
+
+int fputstrv(FILE *f, char **l, const char *separator, bool *space) {
+ bool b = false;
+ char **s;
+ int r;
+
+ /* Like fputs(), but for strv, and with a less stupid argument order */
+
+ if (!space)
+ space = &b;
+
+ STRV_FOREACH(s, l) {
+ r = fputs_with_space(f, *s, separator, space);
+ if (r < 0)
+ return r;
+ }
+
+ return 0;
+}