diff options
author | John Gilmore <gnu@cygnus> | 1991-04-05 09:02:10 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-04-05 09:02:10 +0000 |
commit | 3f2e006b77f217bbf4a4cb9299cf248058a44ed3 (patch) | |
tree | 60b9a78e945e02698d856ea5b82982fe549b26f2 /gdb/command.c | |
parent | 07d021a6ae8d3ed9da9f55c8623739e7a716308e (diff) | |
download | gdb-3f2e006b77f217bbf4a4cb9299cf248058a44ed3.zip gdb-3f2e006b77f217bbf4a4cb9299cf248058a44ed3.tar.gz gdb-3f2e006b77f217bbf4a4cb9299cf248058a44ed3.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'gdb/command.c')
-rw-r--r-- | gdb/command.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gdb/command.c b/gdb/command.c index 0b541a7..dc9d5fc 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -1138,6 +1138,51 @@ make_command (arg, from_tty) shell_escape (p, from_tty); } +static void +user_info_1 (c, stream) + struct cmd_list_element *c; + FILE *stream; +{ + register struct command_line *cmdlines; + + cmdlines = c->user_commands; + if (!cmdlines) + return; + fprintf_filtered (stream, "User command %s:\n", c->name); + while (cmdlines) + { + fprintf_filtered (stream, "%s\n", cmdlines->line); + cmdlines = cmdlines->next; + } + fputs_filtered ("\n", stream); +} + +/* ARGSUSED */ +static void +user_info (args, from_tty) + char *args; + int from_tty; +{ + struct cmd_list_element *c; + extern struct cmd_list_element *cmdlist; + + if (args) + { + c = lookup_cmd (&args, cmdlist, "", 0, 1); + if (c->class != class_user) + error ("Not a user command."); + user_info_1 (c, stdout); + } + else + { + for (c = cmdlist; c; c = c->next) + { + if (c->class == class_user) + user_info_1 (c, stdout); + } + } +} + void _initialize_command () { @@ -1147,4 +1192,8 @@ With no arguments, run an inferior shell."); add_com ("make", class_support, make_command, "Run the ``make'' program using the rest of the line as arguments."); + + add_info ("user", user_info, "Show definitions of user defined commands.\n\ +Argument is the name of the user defined command.\n\ +With no argument, show definitions of all user defined commands."); } |