summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/cli/cli-cmds.c3
-rw-r--r--gdb/completer.c8
-rw-r--r--gdb/completer.h2
4 files changed, 21 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 07cf65aeb95..b97e14d0d08 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2002-01-10 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * completer.c (command_completer): New function.
+
+ * completer.h <command_completer>: Add prototype.
+
+ * cli/cli-cmds.c (init_cli_cmds): Make command_completer be the
+ completer for the "help" command.
+
2002-01-09 Jason Merrill <jason@redhat.com>
* c-typeprint.c (is_type_conversion_operator): Fix thinko.
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 3cf9519a93c..3e3aec4dad7 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -668,7 +668,8 @@ when gdb is started.", &cmdlist);
c->completer = filename_completer;
add_com ("quit", class_support, quit_command, "Exit gdb.");
- add_com ("help", class_support, help_command, "Print list of commands.");
+ c = add_com ("help", class_support, help_command, "Print list of commands.");
+ c->completer = command_completer;
add_com_alias ("q", "quit", class_support, 1);
add_com_alias ("h", "help", class_support, 1);
diff --git a/gdb/completer.c b/gdb/completer.c
index f63fe02f993..a06eb65ac08 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -339,6 +339,14 @@ location_completer (char *text, char *word)
return list;
}
+/* Complete on command names. Used by "help". */
+char **
+command_completer (char *text, char *word)
+{
+ return complete_on_cmdlist (cmdlist, text, word);
+}
+
+
/* Here are some useful test cases for completion. FIXME: These should
be put in the test suite. They should be tested with both M-? and TAB.
diff --git a/gdb/completer.h b/gdb/completer.h
index aa0804cafcd..c717a5e5c38 100644
--- a/gdb/completer.h
+++ b/gdb/completer.h
@@ -29,6 +29,8 @@ extern char **filename_completer (char *, char *);
extern char **location_completer (char *, char *);
+extern char **command_completer (char *, char *);
+
extern char *get_gdb_completer_word_break_characters (void);
extern char *get_gdb_completer_quote_characters (void);