diff options
Diffstat (limited to 'src/basic/strv.c')
-rw-r--r-- | src/basic/strv.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c index 79a9d8d421..eaf440a4b2 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -694,6 +694,26 @@ char **strv_reverse(char **l) { return l; } +char **strv_shell_escape(char **l, const char *bad) { + char **s; + + /* Escapes every character in every string in l that is in bad, + * edits in-place, does not roll-back on error. */ + + STRV_FOREACH(s, l) { + char *v; + + v = shell_escape(*s, bad); + if (!v) + return NULL; + + free(*s); + *s = v; + } + + return l; +} + bool strv_fnmatch(char* const* patterns, const char *s, int flags) { char* const* p; |