ping ? On 14/09/2015 20:01, Laurent Vivier wrote: > The goal is to be able to use '-help' alone, or with > a sub-section, i.e. '-help=network,usb'. > > Signed-off-by: Laurent Vivier <lviv...@redhat.com> > --- > vl.c | 31 ++++++++++++++++++++----------- > 1 file changed, 20 insertions(+), 11 deletions(-) > > diff --git a/vl.c b/vl.c > index 1c8b28d..586ce55 100644 > --- a/vl.c > +++ b/vl.c > @@ -2703,19 +2703,28 @@ static const QEMUOption *lookup_opt(int argc, char > **argv, > error_report("invalid option"); > exit(1); > } > - if (!strcmp(popt->name, r + 1)) > - break; > - popt++; > - } > - if (popt->flags & HAS_ARG) { > - if (optind >= argc) { > - error_report("requires an argument"); > - exit(1); > + /* manage arg type: -arg[=param] */ > + optarg = strchr(r + 1, '='); > + if (optarg) { > + if (!strncmp(popt->name, r + 1, optarg - (r + 1))) { > + optarg++; /* skip '=' */ > + break; > + } > + } else { > + if (!strcmp(popt->name, r + 1)) { > + if (popt->flags & HAS_ARG) { > + if (optind >= argc) { > + error_report("requires an argument"); > + exit(1); > + } > + optarg = argv[optind++]; > + loc_set_cmdline(argv, optind - 2, 2); > + } > + break; > + } > } > - optarg = argv[optind++]; > - loc_set_cmdline(argv, optind - 2, 2); > - } else { > optarg = NULL; > + popt++; > } > > *poptarg = optarg; >