From patchwork Thu Aug 9 21:02:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10661 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 6822E23E28 for ; Thu, 9 Aug 2012 21:02:25 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2CE21A18328 for ; Thu, 9 Aug 2012 21:02:25 +0000 (UTC) Received: by ggnf1 with SMTP id f1so955831ggn.11 for ; Thu, 09 Aug 2012 14:02:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=k8+SHym2j+NOo9acVmMt7VoGkvpSOK5TrxDLUa8plIM=; b=ijBYxvCVL41C+iPkZJ6pu6JFAyKGU3o6BwOrhhPQxkc8tiyyX0JQEPNf0Pz+e2pXa8 ZuKV8Cl00m3F4HTCM7uMwoYwxzXbzYtqnaiP+RNxykWHCsYIxV+2TfNHEmYOa7RJvDtB knmxamv5m5M1cHTgJsKJEcl7o3KiyPd2xEmVarVxvm1WMvojJrV3OlqWx2iqoAUyyUqt dt8r719oR3xX17egLhS8HOy+c/TXXp9dPY+5Q06xZq/onzUR5Nle16RmWQRLYM9hHLMg aCfIKiVgwVsh6XvcJd7fpuIxfBH/IpzvscAT0ySNaDdDQ9vVbJ1R8mD/Dttsi/cwAm+m RKYA== Received: by 10.50.57.168 with SMTP id j8mr691441igq.16.1344546144381; Thu, 09 Aug 2012 14:02:24 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.200 with SMTP id ew8csp28729igc; Thu, 9 Aug 2012 14:02:23 -0700 (PDT) Received: by 10.236.191.69 with SMTP id f45mr802478yhn.8.1344546143354; Thu, 09 Aug 2012 14:02:23 -0700 (PDT) Received: from mail-gg0-f178.google.com (mail-gg0-f178.google.com [209.85.161.178]) by mx.google.com with ESMTPS id v19si960802anh.82.2012.08.09.14.02.23 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Aug 2012 14:02:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of peter.maydell@linaro.org) client-ip=209.85.161.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of peter.maydell@linaro.org) smtp.mail=peter.maydell@linaro.org Received: by ggeh3 with SMTP id h3so1086290gge.37 for ; Thu, 09 Aug 2012 14:02:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.106.136 with SMTP id gu8mr2578073igb.23.1344546142460; Thu, 09 Aug 2012 14:02:22 -0700 (PDT) Received: by 10.50.3.9 with HTTP; Thu, 9 Aug 2012 14:02:22 -0700 (PDT) In-Reply-To: <20120809192553.GA2603@otherpad.lan.raisama.net> References: <1343911554-11109-1-git-send-email-peter.maydell@linaro.org> <878vdvvha8.fsf@codemonkey.ws> <20120809192553.GA2603@otherpad.lan.raisama.net> Date: Thu, 9 Aug 2012 22:02:22 +0100 Message-ID: Subject: Re: [Qemu-devel] [PATCH v3] Support 'help' as a synonym for '?' in command line options From: Peter Maydell To: Eduardo Habkost Cc: Anthony Liguori , qemu-devel@nongnu.org, patches@linaro.org, Michael Tokarev , Markus Armbruster , Blue Swirl , Eric Blake X-Gm-Message-State: ALoCoQklYS1j9oklMojvGW02lemq65uFuJCpdrRM23Fr9i90Xr/qBimS4hhWlVYGB5ze0tkdHOLs 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); }