summaryrefslogtreecommitdiff
path: root/util/cutils.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-06-05 14:19:35 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-06-06 11:27:04 +0200
commita38ed811474e953371f848233208c2026c2d1195 (patch)
tree08bc59922e82314ebfaae0faa305244454982eab /util/cutils.c
parente681be7eca0143fe7259ce8233fe5dd8898d072f (diff)
downloadqemu-a38ed811474e953371f848233208c2026c2d1195.tar.gz
qemu-io: Move qemu_strsep() to cutils.c
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'util/cutils.c')
-rw-r--r--util/cutils.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/util/cutils.c b/util/cutils.c
index 8f28896843..0116fcde74 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;