Diff for /libaitcli/inc/aitcli.h between versions 1.2.2.3 and 1.2.2.4

version 1.2.2.3, 2010/06/04 13:51:21 version 1.2.2.4, 2010/06/04 16:16:17
Line 160  typedef struct { Line 160  typedef struct {
 } bindkey_t;  } bindkey_t;
   
   
   /* Commands structure for CLI */
   
   typedef int (*cmd_func_t)(/*linebuffer_t **/ void * __restrict buffer, int argc, char ** __restrict argv);
   struct tagCommand {
           int                     cmd_level;
   
           int                     cmd_min;
           int                     cmd_len;
           char                    cmd_name[STRSIZ];
   
           char                    cmd_info[STRSIZ];
           char                    cmd_help[STRSIZ];
   
           cmd_func_t              cmd_func;
   
           SLIST_ENTRY(tagCommand) cmd_next;
   };
   typedef SLIST_HEAD(slCommandHead, tagCommand) commands_t;
   
   
 /* Main structure, Buffer for CLI work with thread models ;-) special designed by M.Punov */  /* Main structure, Buffer for CLI work with thread models ;-) special designed by M.Punov */
   
 typedef struct {  typedef struct {
Line 177  typedef struct { Line 197  typedef struct {
   
         bindkey_t               *line_keys;          bindkey_t               *line_keys;
   
           commands_t              line_cmds;
   
         int                     line_in;          int                     line_in;
         int                     line_out;          int                     line_out;
 } linebuffer_t;  } linebuffer_t;
   
 /* Commands structure for CLI */  
   
 typedef int (*cmd_func_t)(linebuffer_t * __restrict buffer, int argc, char ** __restrict argv);  
 typedef struct {  
         int                     cmd_level;  
   
         int                     cmd_min;  
         int                     cmd_len;  
         char                    cmd_name[STRSIZ];  
   
         char                    cmd_info[STRSIZ];  
         char                    cmd_help[STRSIZ];  
   
         cmd_func_t              *cmd_func;  
 } commands_t;  
   
   
 /* Error support functions */  /* Error support functions */
   
 // cli_GetErrno() Get error code of last operation  // cli_GetErrno() Get error code of last operation
Line 219  int cli_BindKey(bindkey_t * __restrict key, linebuffer Line 225  int cli_BindKey(bindkey_t * __restrict key, linebuffer
 /*  /*
  * cli_addHistory() Add line to history   * cli_addHistory() Add line to history
  * @buffer = CLI buffer   * @buffer = CLI buffer
 * @str = Add text * @str = Add custom text or if NULL use readed line from CLI buffer
  * return: RETCODE_ERR error, RETCODE_OK ok   * return: RETCODE_ERR error, RETCODE_OK ok
 */  */
 int cli_addHistory(linebuffer_t * __restrict buffer, const char * __restrict str);  int cli_addHistory(linebuffer_t * __restrict buffer, const char * __restrict str);
Line 258  inline int cli_freeLine(linebuffer_t * __restrict buff Line 264  inline int cli_freeLine(linebuffer_t * __restrict buff
  * return: none   * return: none
 */  */
 inline void cli_setPrompt(linebuffer_t * __restrict buffer, const char *prompt);  inline void cli_setPrompt(linebuffer_t * __restrict buffer, const char *prompt);
   /*
    * cli_Printf() Send message to CLI session
    * @buffer = CLI buffer
    * @fmt = printf format string
    * @... = arguments defined in fmt
    * return: none
   */
   inline void cli_Printf(linebuffer_t * __restrict buffer, char *fmt, ...);
   
 /*  /*
  * cliEnd() Clear data, Free resources and close CLI session   * cliEnd() Clear data, Free resources and close CLI session
Line 275  void cliEnd(linebuffer_t * __restrict buffer); Line 289  void cliEnd(linebuffer_t * __restrict buffer);
 linebuffer_t *cliInit(int fin, int fout, const char *prompt);  linebuffer_t *cliInit(int fin, int fout, const char *prompt);
   
 /*  /*
 * cliExec() Execute CLI main loop * cliReadLine() Read line from opened CLI session
 * @cmdList = Commands list * @buffer = CLI buffer
 * @csPrompt = Prompt text * return: NULL if error or !=NULL readed line, must be free after use!
 * return: -1 error, 0 = exit w/^+D, 1 done. 
 */  */
int cliExec(commands_t *cmdList, const char *csPrompt);char *cliReadLine(linebuffer_t * __restrict buffer);
 /*  /*
 * cliNetExec() Execute net CLI main loop * cliLoop() CLI main loop
 * @cmdList = Commands list * @buffer = CLI buffer
 * @csPrompt = Prompt text * @csHistFile = History file name
  * return: RETCODE_ERR error, RETCODE_OK ok
 */
 int cliLoop(linebuffer_t * __restrict buffer, const char *csHistFile);
 
 /*
  * cliLoop() CLI main loop
  * @buffer = CLI buffer
  * @csHistFile = History file name
  * return: RETCODE_ERR error, RETCODE_OK ok
 */
 int cliLoop(linebuffer_t * __restrict buffer, const char *csHistFile);
 /*
  * cliNetLoop() CLI network main loop binded to socket
  * @buffer = CLI buffer
  * @csHistFile = History file name
  * @sock = client socket   * @sock = client socket
  * @term = stdin termios   * @term = stdin termios
  * @win = window size of tty   * @win = window size of tty
 * return: -1 error, 0 = exit w/^+D, 1 done. * return: RETCODE_ERR error, RETCODE_OK ok
 */  */
int cliNetExec(commands_t *cmdList, const char *csPrompt, int sock, struct termios *term, struct winsize *win);int cliNetLoop(linebuffer_t * __restrict buffer, const char *csHistFile, int sock, 
                 struct termios *term, struct winsize *win);
   
   
 /* CLI Helper functions */  /* CLI Helper functions */

Removed from v.1.2.2.3  
changed lines
  Added in v.1.2.2.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>