From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQofb-0007RN-Dx for qemu-devel@nongnu.org; Sun, 29 May 2011 18:41:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQofa-0003Cj-Em for qemu-devel@nongnu.org; Sun, 29 May 2011 18:41:15 -0400 Received: from mail-pz0-f45.google.com ([209.85.210.45]:46762) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQofa-0003Cf-7X for qemu-devel@nongnu.org; Sun, 29 May 2011 18:41:14 -0400 Received: by pzk30 with SMTP id 30so1499606pzk.4 for ; Sun, 29 May 2011 15:41:13 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1306707770-14632-1-git-send-email-cerbere@gmail.com> <1306707770-14632-3-git-send-email-cerbere@gmail.com> From: Alexandre Raymond Date: Sun, 29 May 2011 18:40:53 -0400 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V2 2/3] Cocoa: avoid displaying window when command-line contains '-h' or '-help' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: andreas.faerber@web.de, qemu-devel@nongnu.org I agree that this is not the best way to handle all cases not requiring a G= UI. However, due to the current structure of the code, it was a simple way to cover a very common case without having to refactor the whole cocoa code. Alexandre On Sun, May 29, 2011 at 6:32 PM, Peter Maydell w= rote: > On 29 May 2011 23:22, Alexandre Raymond wrote: >> diff --git a/ui/cocoa.m b/ui/cocoa.m >> index 1ff1ac6..e1312d3 100644 >> --- a/ui/cocoa.m >> +++ b/ui/cocoa.m >> @@ -872,7 +872,8 @@ int main (int argc, const char * argv[]) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (opt[1] =3D=3D '-') { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 opt++; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!strcmp(opt, "-vnc") || >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!strcmp(opt, "-h") || !st= rcmp(opt, "-help") || >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!strcmp(opt, "-= vnc") || >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !strcmp(opt, "-n= ographic") || >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !strcmp(opt, "-v= ersion") || >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !strcmp(opt, "-c= urses")) { > > (1) presumably this doesn't work if you disable the display > with "-display none" ? > (2) it's pretty ugly and not very maintainable -- is there > some restructuring possible to avoid having to hardcode > information about qemu options into the ui code here? > > (It also doesn't catch other cases where qemu prints some > information and exits immediately, like "-cpu ?".) > > -- PMM >