]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/cli/cli-decode.c
This commit was manufactured by cvs2svn to create branch 'gdb_7_0-branch'.
[thirdparty/binutils-gdb.git] / gdb / cli / cli-decode.c
index 4ebf6dc619464523942125f283fe3149b3fdd3d4..3e4f6f57f9a01ca01e3308b8e7dadb8e3502c538 100644 (file)
@@ -251,7 +251,7 @@ add_alias_cmd (char *name, char *oldname, enum command_class class,
                                                     &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;
     }
@@ -397,17 +397,6 @@ add_setshow_cmd_full (char *name,
     *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
@@ -766,10 +755,11 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
                         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*/
@@ -780,7 +770,7 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
                                      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)
@@ -789,8 +779,11 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
                                      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.