diff options
Diffstat (limited to 'polyp/util.c')
-rw-r--r-- | polyp/util.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/polyp/util.c b/polyp/util.c index 039ec264..3ab6d51a 100644 --- a/polyp/util.c +++ b/polyp/util.c @@ -373,3 +373,19 @@ int pa_parse_boolean(const char *v) { return -1; } + +char *pa_split(const char *c, const char *delimiter, const char**state) { + const char *current = *state ? *state : c; + size_t l; + + if (!*current) + return NULL; + + l = strcspn(current, delimiter); + *state = current+l; + + if (**state) + *state++; + + return pa_xstrndup(current, l); +} |