xref: /kvm-unit-tests/lib/util.c (revision e7c68b43e2d1d49e6e2f829ae848a0e85be7c1e6)
1 /*
2  * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
3  *
4  * This work is licensed under the terms of the GNU LGPL, version 2.
5  */
6 #include <libcflat.h>
7 
8 int parse_keyval(char *s, long *val)
9 {
10 	char *p;
11 
12 	p = strchr(s, '=');
13 	if (!p)
14 		return -1;
15 
16 	*val = atol(p+1);
17 	return p - s;
18 }
19