diff options
Diffstat (limited to 'include/qemu/osdep.h')
-rw-r--r-- | include/qemu/osdep.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 80df7253db..840af09cb0 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -109,6 +109,7 @@ extern int daemon(int, int); #include <ctype.h> #include <errno.h> #include <fcntl.h> +#include <getopt.h> #include <sys/stat.h> #include <sys/time.h> #include <assert.h> @@ -604,4 +605,19 @@ extern int qemu_icache_linesize_log; extern int qemu_dcache_linesize; extern int qemu_dcache_linesize_log; +/* + * After using getopt or getopt_long, if you need to parse another set + * of options, then you must reset optind. Unfortunately the way to + * do this varies between implementations of getopt. + */ +static inline void qemu_reset_optind(void) +{ +#ifdef HAVE_OPTRESET + optind = 1; + optreset = 1; +#else + optind = 0; +#endif +} + #endif |