version 1.2.2.14, 2010/06/08 08:05:12
|
version 1.2.2.15, 2010/06/08 08:43:47
|
Line 391 bufComp(int idx, void * __restrict buffer)
|
Line 391 bufComp(int idx, void * __restrict buffer)
|
*app ? i++ : i, *app ? app++ : app); |
*app ? i++ : i, *app ? app++ : app); |
|
|
if (i) { |
if (i) { |
SLIST_FOREACH(cmd, &buf->line_cmds, cmd_next) | SLIST_FOREACH(cmd, &buf->line_cmds, cmd_next) { |
if (cmd->cmd_level == buf->line_level && |
if (cmd->cmd_level == buf->line_level && |
!strncmp(cmd->cmd_name, items[0], strlen(items[0]))) { |
!strncmp(cmd->cmd_name, items[0], strlen(items[0]))) { |
j++; | if (strncmp(cmd->cmd_name, CLI_CMD_SEP, strlen(CLI_CMD_SEP))) { |
c = cmd; | j++; |
strlcat(szLine, " ", STRSIZ); | c = cmd; |
strlcat(szLine, cmd->cmd_name, STRSIZ); | strlcat(szLine, " ", STRSIZ); |
| strlcat(szLine, cmd->cmd_name, STRSIZ); |
| } |
} |
} |
|
} |
|
|
if (i > 1 && c) { |
if (i > 1 && c) { |
/* we are on argument of command and has complition info */ |
/* we are on argument of command and has complition info */ |
Line 414 bufComp(int idx, void * __restrict buffer)
|
Line 417 bufComp(int idx, void * __restrict buffer)
|
/* we on 0 position of prompt, show commands for this level */ |
/* we on 0 position of prompt, show commands for this level */ |
SLIST_FOREACH(cmd, &buf->line_cmds, cmd_next) { |
SLIST_FOREACH(cmd, &buf->line_cmds, cmd_next) { |
if (cmd->cmd_level == buf->line_level) |
if (cmd->cmd_level == buf->line_level) |
j++; | if (strncmp(cmd->cmd_name, CLI_CMD_SEP, strlen(CLI_CMD_SEP))) { |
c = cmd; | j++; |
strlcat(szLine, " ", STRSIZ); | c = cmd; |
strlcat(szLine, cmd->cmd_name, STRSIZ); | strlcat(szLine, " ", STRSIZ); |
| strlcat(szLine, cmd->cmd_name, STRSIZ); |
| } |
} |
} |
} |
} |
|
|
Line 953 cliInit(int fin, int fout, const char *prompt)
|
Line 958 cliInit(int fin, int fout, const char *prompt)
|
/* add helper functions */ |
/* add helper functions */ |
cli_addCommand(buffer, "exit", 0, cli_Cmd_Exit, "exit <cr>", "Exit from console"); |
cli_addCommand(buffer, "exit", 0, cli_Cmd_Exit, "exit <cr>", "Exit from console"); |
cli_addCommand(buffer, "help", 0, cli_Cmd_Help, "help [command] <cr>", "Help screen"); |
cli_addCommand(buffer, "help", 0, cli_Cmd_Help, "help [command] <cr>", "Help screen"); |
|
cli_addCommand(buffer, "-------", 0, NULL, "-------------------------", NULL); |
|
|
/* fill key bindings */ |
/* fill key bindings */ |
// ascii chars & ctrl+chars |
// ascii chars & ctrl+chars |
Line 1388 cliLoop(linebuffer_t * __restrict buffer, const char *
|
Line 1394 cliLoop(linebuffer_t * __restrict buffer, const char *
|
cli_Printf(buffer, "\nCommand '%s' not found!\n", items[0]); |
cli_Printf(buffer, "\nCommand '%s' not found!\n", items[0]); |
ret = -1; |
ret = -1; |
} else |
} else |
ret = cmd->cmd_func(buffer, i, items); | if (cmd->cmd_func) |
| ret = cmd->cmd_func(buffer, i, items); |
| else { |
| clrscrEOL(buffer); |
| printfCR(buffer, 1); |
| } |
} |
} |
|
|
cli_freeLine(buffer); |
cli_freeLine(buffer); |