mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 14:58:25 +00:00
Remove "old"-style CLI handler, since nothing uses it anymore.
Closes issue #11403, patch by eliel. This also completes the janitor project. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90038 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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. */
|
||||
* 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 */
|
||||
|
||||
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);
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user