From a38ed811474e953371f848233208c2026c2d1195 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 5 Jun 2013 14:19:35 +0200 Subject: qemu-io: Move qemu_strsep() to cutils.c Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi --- util/cutils.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'util') diff --git a/util/cutils.c b/util/cutils.c index 8f28896..0116fcd 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -107,6 +107,27 @@ int qemu_strnlen(const char *s, int max_len) return i; } +char *qemu_strsep(char **input, const char *delim) +{ + char *result = *input; + if (result != NULL) { + char *p; + + for (p = result; *p != '\0'; p++) { + if (strchr(delim, *p)) { + break; + } + } + if (*p == '\0') { + *input = NULL; + } else { + *p = '\0'; + *input = p + 1; + } + } + return result; +} + time_t mktimegm(struct tm *tm) { time_t t; -- cgit v1.1