1 #ifndef _UTIL_H_ 2 #define _UTIL_H_ 3 /* 4 * Collection of utility functions to share between unit tests. 5 * 6 * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com> 7 * 8 * This work is licensed under the terms of the GNU LGPL, version 2. 9 */ 10 11 /* 12 * parse_keyval extracts the integer from a string formatted as 13 * string=integer. This is useful for passing expected values to 14 * the unit test on the command line, i.e. it helps parse QEMU 15 * command lines that include something like -append var1=1 var2=2 16 * @s is the input string, likely a command line parameter, and 17 * @val is a pointer to where the integer will be stored. 18 * 19 * Returns the offset of the '=', or -1 if no keyval pair is found. 20 */ 21 extern int parse_keyval(char *s, long *val); 22 23 #endif 24