X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fbasic%2Fstrv.c;h=5c8261d9210d240e767c9c0af831c1dec106a2d9;hb=66ecc207e203db5434610395cd04c40ae8727b58;hp=966cab75d5e79085d260af69ea66aedc0254add9;hpb=4f8a2329ef626675895974d53a6afad68a0d255a;p=elogind.git diff --git a/src/basic/strv.c b/src/basic/strv.c index 966cab75d..5c8261d92 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - /*** This file is part of systemd. @@ -29,6 +27,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" @@ -884,4 +883,23 @@ 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; +} #endif // 0