From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23387 invoked by alias); 5 Nov 2003 22:00:25 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 23379 invoked from network); 5 Nov 2003 22:00:24 -0000 Received: from unknown (HELO grante.dsl.visi.com) (216.70.201.5) by sources.redhat.com with SMTP; 5 Nov 2003 22:00:24 -0000 Received: by grante.dsl.visi.com (Postfix, from userid 500) id 6CC493BF01; Wed, 5 Nov 2003 17:02:46 -0500 (EST) Date: Wed, 05 Nov 2003 22:00:00 -0000 From: Grant Edwards To: Doug Evans Cc: "Newman, Mark (N-Superior Technical Resource Inc)" , gdb@sources.redhat.com Subject: Re: filtering of commands during async operation Message-ID: <20031105220245.GA4424@grante.dsl.visi.com> References: <16297.28959.958906.509597@casey.transmeta.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16297.28959.958906.509597@casey.transmeta.com> User-Agent: Mutt/1.4.1i X-SW-Source: 2003-11/txt/msg00043.txt.bz2 > Good example of why it's useful to avoid using ! with strcmp. > > > The code should be: > > > > if (event_loop_p && target_can_async_p () && target_executing) { > > if (!(strcmp (c->name, "help") == 0) > > && !(strcmp (c->name, "pwd") == 0) > > && !(strcmp (c->name, "show") == 0) > > && !(strcmp (c->name, "stop") == 0)) { > > error ("Cannot execute this command while the target is running."); > > } > > } > > > > Unless someone objects I am going to put in a bug report and a patch. > > Why not just strcmp () != 0 Why not just strcmp() ? if (strcmp() && strcmp() && strcmp()) -- Grant Edwards grante@visi.com