diff options
Diffstat (limited to 'include/asterisk/cli.h')
-rw-r--r-- | include/asterisk/cli.h | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h index d29917d1d..854c189ff 100644 --- a/include/asterisk/cli.h +++ b/include/asterisk/cli.h @@ -142,60 +142,40 @@ struct ast_cli_args { }; struct ast_cli_entry; -typedef int (*old_cli_fn)(int fd, int argc, char *argv[]); -typedef char *(*new_cli_fn)(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); +typedef char *(*cli_fn)(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); /*! \brief descriptor for a cli entry. * \arg \ref CLI_command_API */ struct ast_cli_entry { char * const cmda[AST_MAX_CMD_LEN]; /*!< words making up the command. - * set the first entry to NULL for a new-style entry. */ - - /*! Handler for the command (fd for output, # of args, argument list). - Returns RESULT_SHOWUSAGE for improper arguments. - argv[] has argc 'useful' entries, and an additional NULL entry - at the end so that clients requiring NULL terminated arrays - can use it without need for copies. - You can overwrite argv or the strings it points to, but remember - that this memory is deallocated after the handler returns. - */ - old_cli_fn handler; - - const char *summary; /*!< Summary of the command (< 60 characters) */ - const char *usage; /*!< Detailed usage information */ - - /*! Generate the n-th (starting from 0) possible completion - for a given 'word' following 'line' in position 'pos'. - 'line' and 'word' must not be modified. - Must return a malloc'ed string with the n-th value when available, - or NULL if the n-th completion does not exist. - Typically, the function is called with increasing values for n - until a NULL is returned. - */ - char *(*generator)(const char *line, const char *word, int pos, int n); + * set the first entry to NULL for a new-style entry. */ + + const char *summary; /*!< Summary of the command (< 60 characters) */ + const char *usage; /*!< Detailed usage information */ + struct ast_cli_entry *deprecate_cmd; - int inuse; /*!< For keeping track of usage */ - struct module *module; /*!< module this belongs to */ - char *_full_cmd; /*!< built at load time from cmda[] */ - int cmdlen; /*!< len up to the first invalid char [<{% */ + int inuse; /*!< For keeping track of usage */ + struct module *module; /*!< module this belongs to */ + char *_full_cmd; /*!< built at load time from cmda[] */ + int cmdlen; /*!< len up to the first invalid char [<{% */ /*! \brief This gets set in ast_cli_register() It then gets set to something different when the deprecated command is run for the first time (ie; after we warn the user that it's deprecated) */ - int args; /*!< number of non-null entries in cmda */ - char *command; /*!< command, non-null for new-style entries */ + int args; /*!< number of non-null entries in cmda */ + char *command; /*!< command, non-null for new-style entries */ int deprecated; - new_cli_fn new_handler; - char *_deprecated_by; /*!< copied from the "parent" _full_cmd, on deprecated commands */ + cli_fn handler; + char *_deprecated_by; /*!< copied from the "parent" _full_cmd, on deprecated commands */ /*! For linking */ AST_LIST_ENTRY(ast_cli_entry) list; }; /* XXX the parser in gcc 2.95 gets confused if you don't put a space * between the last arg before VA_ARGS and the comma */ -#define AST_CLI_DEFINE(fn, txt , ... ) { .new_handler = fn, .summary = txt, ## __VA_ARGS__ } +#define AST_CLI_DEFINE(fn, txt , ... ) { .handler = fn, .summary = txt, ## __VA_ARGS__ } /*! * Helper function to generate cli entries from a NULL-terminated array. |