From 8e55157e6abc105ee17d80d91a291ca8e1215733 Mon Sep 17 00:00:00 2001 From: TingPing Date: Mon, 27 Jan 2014 18:08:25 -0500 Subject: Print help messages for user commands --- src/common/outbound.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/common/outbound.c b/src/common/outbound.c index 34e44a7d..d63f8532 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -4084,6 +4084,31 @@ find_internal_command (char *name) sizeof (xc_cmds[0])) - 1, sizeof (xc_cmds[0]), command_compare); } +static gboolean +usercommand_show_help (session *sess, char *name) +{ + struct popup *pop; + gboolean found = FALSE; + char buf[1024]; + GSList *list; + + list = command_list; + while (list) + { + pop = (struct popup *) list->data; + if (!g_ascii_strcasecmp (pop->name, name)) + { + snprintf (buf, sizeof(buf), _("User Command for: %s\n"), pop->cmd); + PrintText (sess, buf); + + found = TRUE; + } + list = list->next; + } + + return found; +} + static void help (session *sess, char *tbuf, char *helpcmd, int quiet) { @@ -4092,8 +4117,10 @@ help (session *sess, char *tbuf, char *helpcmd, int quiet) if (plugin_show_help (sess, helpcmd)) return; - cmd = find_internal_command (helpcmd); + if (usercommand_show_help (sess, helpcmd)) + return; + cmd = find_internal_command (helpcmd); if (cmd) { if (cmd->help) -- cgit 1.4.1