Re: filtering of commands during async operation

Elena Zannoni
2003-11-05T23:11:38Z

Grant Edwards writes:
>
> > 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())
>

Whoops. I agree, this is screwed up. I'll just make the fix now, no
need to file a bug report. I am curious, did somebody get async
native to work? So far there is only the remote async target. I do
remember testing this, back 4 years ago, maybe the logic got turned
around at some point.

I think strcmp != 0 is ok. It is the preferred form in gdb. Is
this in the ARI? mmmm... partially it is. It is not flagged in the
counts though.

elena