diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2009-07-21 00:02:27 +0300 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2009-07-21 00:02:27 +0300 |
commit | 9347e90fed732dac619bb88f6518c344e7436447 (patch) | |
tree | 13b38dbb987296e21e7040d4ae903ddbd2a30d04 /src/pulsecore/core-util.c | |
parent | 5c7952e4fa5e560f64255ef173c3e6570bee433a (diff) |
Finish the Core dbus interface.
Diffstat (limited to 'src/pulsecore/core-util.c')
-rw-r--r-- | src/pulsecore/core-util.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 04e7eb24..ebddf363 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -2656,6 +2656,28 @@ char *pa_replace(const char*s, const char*a, const char *b) { return pa_strbuf_tostring_free(sb); } +char *pa_escape(const char *p, const char *chars) { + const char *s; + const char *c; + pa_strbuf *buf = pa_strbuf_new(); + + for (s = p; *s; ++s) { + if (*s == '\\') + pa_strbuf_putc(buf, '\\'); + else if (chars) { + for (c = chars; *c; ++c) { + if (*s == *c) { + pa_strbuf_putc(buf, '\\'); + break; + } + } + } + pa_strbuf_putc(buf, *s); + } + + return pa_strbuf_tostring_free(buf); +} + char *pa_unescape(char *p) { char *s, *d; pa_bool_t escaped = FALSE; |