From patchwork Thu Aug 9 21:02:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v3] Support 'help' as a synonym for '?' in command line options Date: Thu, 09 Aug 2012 11:02:22 -0000 From: Peter Maydell X-Patchwork-Id: 176275 Message-Id: To: Eduardo Habkost Cc: Anthony Liguori , patches@linaro.org, Michael Tokarev , Markus Armbruster , qemu-devel@nongnu.org, Blue Swirl , Eric Blake On 9 August 2012 20:25, Eduardo Habkost wrote: > On Fri, Aug 03, 2012 at 03:42:39PM -0500, Anthony Liguori wrote: >> Peter Maydell writes: >> > For command line options which permit '?' meaning 'please list the >> > permitted values', add support for 'help' as a synonym, by abstracting >> > the check out into a helper function. >> Applied. Thanks. > > I just found out that this patch broke "-cpu ?dump", "-cpu ?cpuid", and > "-cpu ?model": These options appear to be completely undocumented. They're also pretty ugly syntax and seem to be x86 specific. However we can unbreak them if we must with a patch like this: (will send as a proper patch with commit message and signoff tomorrow). Any suggestions for what the sane syntax for these options would be? (ie the analogous change to having '?' go to 'help'). -- PMM --- a/vl.c +++ b/vl.c @@ -3215,7 +3215,11 @@ int main(int argc, char **argv, char **envp) */ cpudef_init(); - if (cpu_model && is_help_option(cpu_model)) { + /* We have to check for "starts with '?' as well as is_help_option + * to support targets which implement various weird help options + * via '?thingy' syntax. + */ + if (cpu_model && (is_help_option(cpu_model) || *cpu_model == '?')) { list_cpus(stdout, &fprintf, cpu_model); exit(0); }