aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>2002-07-03 17:35:21 +0000
committerMartin Hunt <hunt@redhat.com>2002-07-03 17:35:21 +0000
commitf436dd25ca221a4536350cc2ef3a3783c03dd52d (patch)
treec2a30b755d003e22681545c3274ceadd685cb79f /gdb/cli
parent4cfe20842d3acb054c3ade521a1bf66b05b82cb9 (diff)
downloadgdb-f436dd25ca221a4536350cc2ef3a3783c03dd52d.zip
gdb-f436dd25ca221a4536350cc2ef3a3783c03dd52d.tar.gz
gdb-f436dd25ca221a4536350cc2ef3a3783c03dd52d.tar.bz2
2002-07-03 Martin M. Hunt <hunt@redhat.com>
* top.c (execute_command): Use cmd_func() and cmd_func_p(). * cli/cli-decode.c (cmd_func_p): New function. (cmd_func): New function. * command.h: Add cmd_func() and cmd_func_p().
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-decode.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 098c13a..84e445e 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1505,3 +1505,23 @@ complete_on_enum (const char *enumlist[],
return matchlist;
}
+
+/* check function pointer */
+int
+cmd_func_p (struct cmd_list_element *cmd)
+{
+ return (cmd->func != NULL);
+}
+
+
+/* call the command function */
+void
+cmd_func (struct cmd_list_element *cmd, char *args, int from_tty)
+{
+ if (cmd_func_p (cmd))
+ (*cmd->func) (cmd, args, from_tty);
+ else
+ error ("Invalid command");
+}
+
+