mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-04 13:57:12 +08:00
2000-12-06 Fernando Nasser <fnasser@redhat.com>
* cli/cli-decode.c (lookup_cmd): Remove old stale copy of this routine which was not being used for quite some time.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2000-12-06 Fernando Nasser <fnasser@redhat.com>
|
||||||
|
|
||||||
|
* cli/cli-decode.c (lookup_cmd): Remove old stale copy of this routine
|
||||||
|
which was not being used for quite some time.
|
||||||
|
|
||||||
2000-12-05 Mark Kettenis <kettenis@gnu.org>
|
2000-12-05 Mark Kettenis <kettenis@gnu.org>
|
||||||
|
|
||||||
* gdb-stabs.h (SECT_OFF_MAX): Increase to 64.
|
* gdb-stabs.h (SECT_OFF_MAX): Increase to 64.
|
||||||
|
@ -1211,143 +1211,6 @@ lookup_cmd_composition (char *text,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Look up the contents of *LINE as a command in the command list LIST.
|
|
||||||
LIST is a chain of struct cmd_list_element's.
|
|
||||||
If it is found, return the struct cmd_list_element for that command
|
|
||||||
and update *LINE to point after the command name, at the first argument.
|
|
||||||
If not found, call error if ALLOW_UNKNOWN is zero
|
|
||||||
otherwise (or if error returns) return zero.
|
|
||||||
Call error if specified command is ambiguous,
|
|
||||||
unless ALLOW_UNKNOWN is negative.
|
|
||||||
CMDTYPE precedes the word "command" in the error message. */
|
|
||||||
|
|
||||||
struct cmd_list_element *
|
|
||||||
lookup_cmd (char **line, struct cmd_list_element *list, char *cmdtype,
|
|
||||||
int allow_unknown)
|
|
||||||
{
|
|
||||||
register char *p;
|
|
||||||
register struct cmd_list_element *c, *found;
|
|
||||||
int nfound;
|
|
||||||
char ambbuf[100];
|
|
||||||
char *processed_cmd;
|
|
||||||
int i, cmd_len;
|
|
||||||
|
|
||||||
/* Skip leading whitespace. */
|
|
||||||
|
|
||||||
while (**line == ' ' || **line == '\t')
|
|
||||||
(*line)++;
|
|
||||||
|
|
||||||
/* Clear out trailing whitespace. */
|
|
||||||
|
|
||||||
p = *line + strlen (*line);
|
|
||||||
while (p != *line && (p[-1] == ' ' || p[-1] == '\t'))
|
|
||||||
p--;
|
|
||||||
*p = 0;
|
|
||||||
|
|
||||||
/* Find end of command name. */
|
|
||||||
|
|
||||||
p = *line;
|
|
||||||
while (*p == '-' || isalnum (*p))
|
|
||||||
p++;
|
|
||||||
|
|
||||||
/* Look up the command name.
|
|
||||||
If exact match, keep that.
|
|
||||||
Otherwise, take command abbreviated, if unique. Note that (in my
|
|
||||||
opinion) a null string does *not* indicate ambiguity; simply the
|
|
||||||
end of the argument. */
|
|
||||||
|
|
||||||
if (p == *line)
|
|
||||||
{
|
|
||||||
if (!allow_unknown)
|
|
||||||
error ("Lack of needed %scommand", cmdtype);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy over to a local buffer, converting to lowercase on the way.
|
|
||||||
This is in case the command being parsed is a subcommand which
|
|
||||||
doesn't match anything, and that's ok. We want the original
|
|
||||||
untouched for the routine of the original command. */
|
|
||||||
|
|
||||||
processed_cmd = (char *) alloca (p - *line + 1);
|
|
||||||
for (cmd_len = 0; cmd_len < p - *line; cmd_len++)
|
|
||||||
{
|
|
||||||
char x = (*line)[cmd_len];
|
|
||||||
if (isupper (x))
|
|
||||||
processed_cmd[cmd_len] = tolower (x);
|
|
||||||
else
|
|
||||||
processed_cmd[cmd_len] = x;
|
|
||||||
}
|
|
||||||
processed_cmd[cmd_len] = '\0';
|
|
||||||
|
|
||||||
/* Check all possibilities in the current command list. */
|
|
||||||
found = 0;
|
|
||||||
nfound = 0;
|
|
||||||
for (c = list; c; c = c->next)
|
|
||||||
{
|
|
||||||
if (!strncmp (processed_cmd, c->name, cmd_len))
|
|
||||||
{
|
|
||||||
found = c;
|
|
||||||
nfound++;
|
|
||||||
if (c->name[cmd_len] == 0)
|
|
||||||
{
|
|
||||||
nfound = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Report error for undefined command name. */
|
|
||||||
|
|
||||||
if (nfound != 1)
|
|
||||||
{
|
|
||||||
if (nfound > 1 && allow_unknown >= 0)
|
|
||||||
{
|
|
||||||
ambbuf[0] = 0;
|
|
||||||
for (c = list; c; c = c->next)
|
|
||||||
if (!strncmp (processed_cmd, c->name, cmd_len))
|
|
||||||
{
|
|
||||||
if (strlen (ambbuf) + strlen (c->name) + 6 < sizeof ambbuf)
|
|
||||||
{
|
|
||||||
if (strlen (ambbuf))
|
|
||||||
strcat (ambbuf, ", ");
|
|
||||||
strcat (ambbuf, c->name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcat (ambbuf, "..");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
error ("Ambiguous %scommand \"%s\": %s.", cmdtype,
|
|
||||||
processed_cmd, ambbuf);
|
|
||||||
}
|
|
||||||
else if (!allow_unknown)
|
|
||||||
error ("Undefined %scommand: \"%s\".", cmdtype, processed_cmd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Skip whitespace before the argument. */
|
|
||||||
|
|
||||||
while (*p == ' ' || *p == '\t')
|
|
||||||
p++;
|
|
||||||
*line = p;
|
|
||||||
|
|
||||||
if (found->prefixlist && *p)
|
|
||||||
{
|
|
||||||
c = lookup_cmd (line, *found->prefixlist, found->prefixname,
|
|
||||||
found->allow_unknown);
|
|
||||||
if (c)
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Helper function for SYMBOL_COMPLETION_FUNCTION. */
|
/* Helper function for SYMBOL_COMPLETION_FUNCTION. */
|
||||||
|
|
||||||
/* Return a vector of char pointers which point to the different
|
/* Return a vector of char pointers which point to the different
|
||||||
|
Reference in New Issue
Block a user