@@ -3644,7 +3644,7 @@ void bdrv_img_create(const char *filename, const char *fmt,
}
if (!quiet) {
- printf("Formatting '%s', fmt=%s", filename, fmt);
+ printf("Formatting '%s', fmt=%s ", filename, fmt);
qemu_opts_print(opts, " ");
puts("");
}
@@ -728,14 +728,16 @@ void qemu_opts_del(QemuOpts *opts)
g_free(opts);
}
-void qemu_opts_print(QemuOpts *opts, const char *sep)
+void qemu_opts_print(QemuOpts *opts, const char *d_sep)
{
QemuOpt *opt;
QemuOptDesc *desc = opts->list->desc;
+ const char *sep = "";
if (desc[0].name == NULL) {
QTAILQ_FOREACH(opt, &opts->head, next) {
printf("%s%s=\"%s\"", sep, opt->name, opt->str);
+ sep = d_sep;
}
return;
}
@@ -755,6 +757,7 @@ void qemu_opts_print(QemuOpts *opts, const char *sep)
} else {
printf("%s%s=%s", sep, desc->name, value);
}
+ sep = d_sep;
}
}
This allows to print options in a format that the user would actually write it on the command line (foo=bar,baz=asd,etc=def), without prepending a spurious comma at the beginning of the list. Only block.c depended on the old behavior, but it was also updated. Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> --- block.c | 2 +- util/qemu-option.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)