From 58e46bf8447f7c4ab96dd15251b769bc5647f7db Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Fri, 8 Feb 2013 14:27:29 +0100 Subject: cli: Modify regexp command handler registration Pass a full string, instead of an array of words, to the "help" callback of regexp command handlers. Also register these command handlers using a regexp to apply on "help" commands, just like for exec commands. The "help" callback will then be called only if the command matches the "help" regexp. As a side effect, the "help" word and its following spaces are skipped before calling the "help" callback for both simple and regexp commands. Signed-off-by: Guillaume Nault --- accel-pppd/cli/cli.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'accel-pppd/cli/cli.h') diff --git a/accel-pppd/cli/cli.h b/accel-pppd/cli/cli.h index 1fbb985..b02b2bb 100644 --- a/accel-pppd/cli/cli.h +++ b/accel-pppd/cli/cli.h @@ -26,7 +26,10 @@ struct cli_regexp_cmd_t const char *pattern; int options; int (*exec)(const char *cmd, void *client); - int (*help)(char * const *fields, int field_cnt, void *client); + pcre *h_re; + const char *h_pattern; + int h_options; + int (*help)(const char *cmd, void *client); }; struct ap_session; -- cgit v1.2.3