mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-14 13:58:38 +00:00
Version 0.1.10 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -28,35 +28,51 @@ extern void ast_cli(int fd, char *fmt, ...);
|
||||
|
||||
#define AST_MAX_CMD_LEN 16
|
||||
|
||||
/* A command line entry */
|
||||
#define AST_MAX_ARGS 64
|
||||
|
||||
//! A command line entry */
|
||||
struct ast_cli_entry {
|
||||
/* Null terminated list of the words of the command */
|
||||
/*! Null terminated list of the words of the command */
|
||||
char *cmda[AST_MAX_CMD_LEN];
|
||||
/* Handler for the command (fd for output, # of arguments, argument list).
|
||||
Returns RESULT_SHOWUSAGE for improper arguments */
|
||||
/*! Handler for the command (fd for output, # of arguments, argument list). Returns RESULT_SHOWUSAGE for improper arguments */
|
||||
int (*handler)(int fd, int argc, char *argv[]);
|
||||
/* Summary of the command (< 60 characters) */
|
||||
/*! Summary of the command (< 60 characters) */
|
||||
char *summary;
|
||||
/* Detailed usage information */
|
||||
/*! Detailed usage information */
|
||||
char *usage;
|
||||
/* Generate a list of possible completions for a given word */
|
||||
/*! Generate a list of possible completions for a given word */
|
||||
char *(*generator)(char *line, char *word, int pos, int state);
|
||||
/* For linking */
|
||||
/*! For linking */
|
||||
struct ast_cli_entry *next;
|
||||
};
|
||||
|
||||
/* Interpret a command s, sending output to fd */
|
||||
//! Interprets a command
|
||||
/*! Interpret a command s, sending output to fd
|
||||
* Returns 0 on succes, -1 on failure
|
||||
*/
|
||||
extern int ast_cli_command(int fd, char *s);
|
||||
|
||||
/* Register your own command */
|
||||
//! Registers a command
|
||||
/*!
|
||||
* \param fd File descriptor that I/O is done to
|
||||
* \param s string given at prompt
|
||||
* Register your own command
|
||||
* Returns 0 on success, -1 on failure
|
||||
*/
|
||||
extern int ast_cli_register(struct ast_cli_entry *e);
|
||||
|
||||
/* Unregister your own command */
|
||||
//! Unregisters a command
|
||||
/*!
|
||||
* \param e which cli entry to unregister
|
||||
* Unregister your own command. You must pass a completed ast_cli_entry structur
|
||||
* Returns 0 on success, -1 on failure
|
||||
*/
|
||||
extern int ast_cli_unregister(struct ast_cli_entry *e);
|
||||
|
||||
/* Useful for readline, that's about it */
|
||||
//! Readline madness
|
||||
/* Useful for readline, that's about it
|
||||
* Returns 0 on success, -1 on failure
|
||||
*/
|
||||
extern char *ast_cli_generator(char *, char *, int);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
|
||||
Reference in New Issue
Block a user