return cmd->context;
}
-void
-set_cmd_no_selected_thread_ok (struct cmd_list_element *cmd)
-{
- cmd->flags |= CMD_NO_SELECTED_THREAD_OK;
-}
-
-int
-get_cmd_no_selected_thread_ok (struct cmd_list_element *cmd)
-{
- return cmd->flags & CMD_NO_SELECTED_THREAD_OK;
-}
-
enum cmd_types
cmd_type (struct cmd_list_element *cmd)
{
void
set_cmd_completer (struct cmd_list_element *cmd,
- char **(*completer) (char *text, char *word))
+ char **(*completer) (struct cmd_list_element *self,
+ char *text, char *word))
{
cmd->completer = completer; /* Ok. */
}
c->prefixname = NULL;
c->allow_unknown = 0;
c->abbrev_flag = 0;
- set_cmd_completer (c, make_symbol_completion_list);
+ set_cmd_completer (c, make_symbol_completion_list_fn);
+ c->destroyer = NULL;
c->type = not_set_cmd;
c->var = NULL;
c->var_type = var_boolean;
&prehook, &prehookee,
&posthook, &posthookee);
/* If this happens, it means a programmer error somewhere. */
- gdb_assert (!aliases && !prehook && prehookee
+ gdb_assert (!aliases && !prehook && !prehookee
&& !posthook && ! posthookee);
return 0;
}
*show_result = show;
}
-struct cmd_list_element *
-deprecated_add_set_cmd (char *name,
- enum command_class class,
- var_types var_type,
- void *var,
- char *doc,
- struct cmd_list_element **list)
-{
- return add_set_or_show_cmd (name, set_cmd, class, var_type, var, doc, list);
-}
-
/* Add element named NAME to command list LIST (the list for set or
some sublist thereof). CLASS is as in add_cmd. ENUMLIST is a list
of strings which may follow NAME. VAR is address of the variable
{
if (strcmp (iter->name, name) == 0)
{
+ if (iter->destroyer)
+ iter->destroyer (iter, iter->context);
if (iter->hookee_pre)
iter->hookee_pre->hook_pre = 0;
*prehook = iter->hook_pre;
struct re_pattern_buffer *regex, char *prefix)
{
struct cmd_list_element *c;
- int returnvalue=1; /*Needed to avoid double printing*/
+ int returnvalue;
/* Walk through the commands */
for (c=commandlist;c;c=c->next)
{
+ returnvalue = -1; /*Needed to avoid double printing*/
if (c->name != NULL)
{
/* Try to match against the name*/
0 /* don't recurse */, stream);
}
}
- if (c->doc != NULL && returnvalue != 0)
+ if (c->doc != NULL && returnvalue < 0)
{
/* Try to match against documentation */
if (re_search(regex,c->doc,strlen(c->doc),0,strlen(c->doc),NULL) >=0)
0 /* don't recurse */, stream);
}
}
- /* Check if this command has subcommands */
- if (c->prefixlist != NULL)
+ /* Check if this command has subcommands and is not an abbreviation.
+ We skip listing subcommands of abbreviations in order to avoid
+ duplicates in the output.
+ */
+ if (c->prefixlist != NULL && !c->abbrev_flag)
{
/* Recursively call ourselves on the subcommand list,
passing the right prefix in.