Diff for /libaitcli/example/test.c between versions 1.1 and 1.5

version 1.1, 2010/04/16 13:20:29 version 1.5, 2013/11/20 16:26:51
Line 4 Line 4
   
   
 // This export commands, good place for write is global header file  // This export commands, good place for write is global header file
CLI_REGISTER_COMMANDS(commands)//CLI_REGISTER_COMMANDS(commands)
 //  //
   
 // ---------------------------------------------------------------  // ---------------------------------------------------------------
/*
 int cmd_test1(void *cmds, int idx, FILE *out, char ** __restrict args)  int cmd_test1(void *cmds, int idx, FILE *out, char ** __restrict args)
 {  {
         cliCommands_t *c = cmds;          cliCommands_t *c = cmds;
Line 51  cliCommands_t commands[] = { Line 51  cliCommands_t commands[] = {
         { "exit", cli_Cmd_Exit, "Exit from console", "exit <cr>", NULL },           { "exit", cli_Cmd_Exit, "Exit from console", "exit <cr>", NULL }, 
         { NULL, NULL, NULL, NULL, NULL }          { NULL, NULL, NULL, NULL, NULL }
 };  };
   */
   
   static int
   oho(void *buf, int idx, char **argv)
   {
           printf("Oho!!!! level 0\n");
           return 0;
   }
   
   static int
   boho(void *buf, int idx, char **argv)
   {
           printf("Boho !!!! level 1\n");
           return 0;
   }
   
 // ---------------------------------------  // ---------------------------------------
   
int main()int
 main(int argc, char **argv)
 {  {
         int ret;          int ret;
           linebuffer_t *t;
   
        ret = cliExec(commands, stdout, "test>");//        ret = cliExec(commands, "test>");
         t = cliInit(0, 1, argv[1]);
         cli_addCommand(t, "oho", 1, oho, "oho [args]", "oho - is test level 0");
         cli_addCommand(t, "boho", 2, boho, "boho [args]", "boho - is test level 1");
         ret = cliLoop(t, NULL, 10, argc > 2 ? argv[2] : NULL);
         cliEnd(t);
   
         return 0;          return 0;
 }  }

Removed from v.1.1  
changed lines
  Added in v.1.5


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