fprintf(stderr, "Option '%s' needs a number as parameter\n", name);
return -1;
}
+ *ret = number;
} else {
fprintf(stderr, "Option '%s' needs a parameter\n", name);
return -1;
return 0;
}
+int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
+ int abort_on_failure)
+{
+ QemuOpt *opt;
+ int rc = 0;
+
+ TAILQ_FOREACH(opt, &opts->head, next) {
+ rc = func(opt->name, opt->str, opaque);
+ if (abort_on_failure && rc != 0)
+ break;
+ }
+ return rc;
+}
+
QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id)
{
QemuOpts *opts;
return qemu_opt_set(opts, name, value);
}
+const char *qemu_opts_id(QemuOpts *opts)
+{
+ return opts->id;
+}
+
void qemu_opts_del(QemuOpts *opts)
{
QemuOpt *opt;
QemuOpts *opts;
const char *p,*pe,*pc;
- if (get_param_value(value, sizeof(value), "id", params))
+ if (strncmp(params, "id=", 3) == 0) {
+ get_opt_value(value, sizeof(value), params+3);
id = qemu_strdup(value);
+ } else if ((p = strstr(params, ",id=")) != NULL) {
+ get_opt_value(value, sizeof(value), p+4);
+ id = qemu_strdup(value);
+ }
opts = qemu_opts_create(list, id, 1);
if (opts == NULL)
return NULL;