diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 1999-12-19 22:38:55 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 1999-12-19 22:38:55 +0000 |
commit | a4430bca536242afea56468f9e9cb669c5bfa77d (patch) | |
tree | d04c949294343ad1033dca9dc4c81812481e4e1b /include/asterisk/cli.h | |
parent | 8a317c03a2bf05b95e939bff76e48e06e93a1777 (diff) |
Version 0.1.1 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@142 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/cli.h')
-rwxr-xr-x | include/asterisk/cli.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h new file mode 100755 index 000000000..3720e4567 --- /dev/null +++ b/include/asterisk/cli.h @@ -0,0 +1,66 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Standard Command Line Interface + * + * Copyright (C) 1999, Mark Spencer + * + * Mark Spencer <markster@linux-support.net> + * + * This program is free software, distributed under the terms of + * the GNU General Public License + */ + +#ifndef _ASTERISK_CLI_H +#define _ASTERISK_CLI_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include <stdarg.h> + +extern void ast_cli(int fd, char *fmt, ...); + +#define RESULT_SUCCESS 0 +#define RESULT_SHOWUSAGE 1 +#define RESULT_FAILURE 2 + +#define AST_MAX_CMD_LEN 16 + +/* A command line entry */ +#define AST_MAX_ARGS 64 + +struct ast_cli_entry { + /* 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 */ + int (*handler)(int fd, int argc, char *argv[]); + /* Summary of the command (< 60 characters) */ + char *summary; + /* Detailed usage information */ + char *usage; + /* Generate a list of possible completions for a given word */ + char *(*generator)(char *line, char *word, int pos, int state); + /* For linking */ + struct ast_cli_entry *next; +}; + +/* Interpret a command s, sending output to fd */ +extern int ast_cli_command(int fd, char *s); + +/* Register your own command */ +extern int ast_cli_register(struct ast_cli_entry *e); + +/* Unregister your own command */ +extern int ast_cli_unregister(struct ast_cli_entry *e); + +/* Useful for readline, that's about it */ +extern char *ast_cli_generator(char *, char *, int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif |