diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-11 05:26:17 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-11 12:15:39 -0800 |
commit | 2d3cc1eac126990c5cd4ca8a47b0c09814dc1e5c (patch) | |
tree | 2cd172276cee6e897d41926c9e04040211cc7bb8 /src/helper/command.h | |
parent | f93c98081f58f1487d518356a05edf219b0237c3 (diff) |
add command_name helper
The command_name function returns a malloced string for a given
command and its parents. This can be used to display a message
to the user, but it is used internally to handle registration
and syntax errors. This helps permit arbitrary command nesting.
Diffstat (limited to 'src/helper/command.h')
-rw-r--r-- | src/helper/command.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/helper/command.h b/src/helper/command.h index 0b86b881..732fa525 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -84,6 +84,16 @@ typedef struct command_s struct command_s *next; } command_t; +/** + * @param c The command to be named. + * @param delim The character to place between command names. + * @returns A malloc'd string containing the full command name, + * which may include one or more ancestor components. Multiple names + * are separated by single spaces. The caller must free() the string + * when done with it. + */ +char *command_name(struct command_s *c, char delim); + command_t* register_command(command_context_t *context, command_t *parent, char *name, int (*handler)(struct command_context_s *context, |