|
version 1.2.2.1, 2010/06/04 12:08:32
|
version 1.2.2.3, 2010/06/04 13:51:21
|
|
Line 10
|
Line 10
|
| #define __AITCLI_H |
#define __AITCLI_H |
| |
|
| |
|
| |
#define STRSIZ 256 |
| |
|
| /* Key definitions */ |
/* Key definitions */ |
| |
|
| #define K_F1 "\x1b\x4f\x50" |
#define K_F1 "\x1b\x4f\x50" |
|
Line 207 inline const char *cli_GetError();
|
Line 209 inline const char *cli_GetError();
|
| /* CLI Functions */ |
/* CLI Functions */ |
| |
|
| /* |
/* |
| |
* cli_BindKey() Bind function to key |
| |
* @key = key structure |
| |
* @buffer = CLI buffer |
| |
* return: RETCODE_ERR error, RETCODE_OK ok, >0 bind at position |
| |
*/ |
| |
int cli_BindKey(bindkey_t * __restrict key, linebuffer_t * __restrict buffer); |
| |
|
| |
/* |
| |
* cli_addHistory() Add line to history |
| |
* @buffer = CLI buffer |
| |
* @str = Add text |
| |
* return: RETCODE_ERR error, RETCODE_OK ok |
| |
*/ |
| |
int cli_addHistory(linebuffer_t * __restrict buffer, const char * __restrict str); |
| |
/* |
| |
* cli_saveHistory() Save history to file |
| |
* @buffer = CLI buffer |
| |
* @histfile = History filename, if NULL will be use default name |
| |
* @lines = Maximum history lines to save |
| |
* return: RETCODE_ERR error, RETCODE_OK ok |
| |
*/ |
| |
int cli_saveHistory(linebuffer_t * __restrict buffer, const char *histfile, int lines); |
| |
/* |
| |
* cli_loadHistory() Load history from file |
| |
* @buffer = CLI buffer |
| |
* @histfile = History filename, if NULL will be use default name |
| |
* return: RETCODE_ERR error, RETCODE_OK ok |
| |
*/ |
| |
int cli_loadHistory(linebuffer_t * __restrict buffer, const char *histfile); |
| |
/* |
| |
* cli_resetHistory() Reset history search in CLI session |
| |
* @buffer = CLI buffer |
| |
* return: none |
| |
*/ |
| |
inline void cli_resetHistory(linebuffer_t * __restrict buffer); |
| |
|
| |
/* |
| |
* cli_freeLine() Clear entire line |
| |
* @buffer = CLI buffer |
| |
* return: RETCODE_ERR error, RETCODE_OK ok |
| |
*/ |
| |
inline int cli_freeLine(linebuffer_t * __restrict buffer); |
| |
/* |
| |
* cli_setPrompt() Set new prompt for CLI session |
| |
* @buffer = CLI buffer |
| |
* @prompt = new text for prompt or if NULL disable prompt |
| |
* return: none |
| |
*/ |
| |
inline void cli_setPrompt(linebuffer_t * __restrict buffer, const char *prompt); |
| |
|
| |
/* |
| |
* cliEnd() Clear data, Free resources and close CLI session |
| |
* @buffer = CLI buffer |
| |
* return: RETCODE_ERR error, RETCODE_OK ok |
| |
*/ |
| |
void cliEnd(linebuffer_t * __restrict buffer); |
| |
/* |
| |
* cliInit() Start CLI session, allocate memory for resources and bind keys |
| |
* @fin = Input device handle |
| |
* @fout = Output device handle |
| |
* @prompt = text for prompt, if NULL disable prompt |
| |
* return: NULL if error or !=NULL CLI buffer |
| |
*/ |
| |
linebuffer_t *cliInit(int fin, int fout, const char *prompt); |
| |
|
| |
/* |
| * cliExec() Execute CLI main loop |
* cliExec() Execute CLI main loop |
| * @cmdList = Commands list |
* @cmdList = Commands list |
| * @csPrompt = Prompt text |
* @csPrompt = Prompt text |
| * return: -1 error, 0 = exit w/^+D, 1 done. |
* return: -1 error, 0 = exit w/^+D, 1 done. |
| */ |
*/ |
| int cliExec(cliCommands_t *cmdList, const char *csPrompt); | int cliExec(commands_t *cmdList, const char *csPrompt); |
| /* |
/* |
| * cliNetExec() Execute net CLI main loop |
* cliNetExec() Execute net CLI main loop |
| * @cmdList = Commands list |
* @cmdList = Commands list |
|
Line 222 int cliExec(cliCommands_t *cmdList, const char *csProm
|
Line 290 int cliExec(cliCommands_t *cmdList, const char *csProm
|
| * @win = window size of tty |
* @win = window size of tty |
| * return: -1 error, 0 = exit w/^+D, 1 done. |
* return: -1 error, 0 = exit w/^+D, 1 done. |
| */ |
*/ |
| int cliNetExec(cliCommands_t *cmdList, const char *csPrompt, int sock, struct termios *term, struct winsize *win); | int cliNetExec(commands_t *cmdList, const char *csPrompt, int sock, struct termios *term, struct winsize *win); |
| |
|
| |
|
| /* CLI Helper functions */ |
/* CLI Helper functions */ |