xref: /kvm-unit-tests/lib/util.c (revision 4363f1d9a646a5c7ea673bee8fc33ca6f2cddbd8)
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 #include "util.h"
8 
9 int parse_keyval(char *s, long *val)
10 {
11 	char *p;
12 
13 	p = strchr(s, '=');
14 	if (!p)
15 		return -1;
16 
17 	*val = atol(p+1);
18 	return p - s;
19 }
20