Re: [PATCH] Fix 'Undefined command' error message

Daniel Jacobowitz
2005-11-16T20:13:09Z

On Tue, Nov 15, 2005 at 08:13:38PM +0200, Eli Zaretskii wrote:
> > Date: Tue, 15 Nov 2005 14:09:14 +0000
> > From: Andrew STUBBS <andrew.stubbs@st.com>
> >
> > - while (isalnum (*p) || *p == '-')
> > + while (*p && (isalnum (*p) || *p == '-' || *p == '_' ||
>
> Why is there a need for testing *p to be non-zero? AFAIK, isalnum is
> well defined for a zero argument.

Just to clarify when the end of the loop is? You're right, it should
not be necessary.

> > +#if defined(TUI)
> > + (tui_active &&
> > + (*p == '+' || *p == '<' || *p == '>' || *p == '$')) ||
> > +#endif
>
> What is the reason for additional tests under TUI?

The TUI has commands which include these. E.g. + is scroll forward;
search for add_com in tui/.

> > + (xdb_commands && (*p == '!' || *p == '/' || *p == '?'))))
>
> Is this for some kind of compatibility with XDB?

And xdb has some commands which include these, which GDB emulates, I
presume. ! is for an xdb-specific alias to shell. (With a comment
from Andrew above it mentioning that using a different syntax would be
more useful. Personally, I think we don't need to bind ! to that so
much as we need to bind it to bash-style command history.)

/ and ? are bound to forward and reverse search in the source file.

Found these with grep also, although it took me a little longer.

Does anyone use xdb compatibility any more? I suspect we could remove
it, but I've no way to know.

The other characters could presumably be allowed unconditionally
without doing any harm, but I haven't tried that.

--
Daniel Jacobowitz
CodeSourcery, LLC