|
version 1.1.1.1, 2010/04/16 13:20:29
|
version 1.1.1.1.4.2, 2010/06/07 11:54:00
|
|
Line 11
|
Line 11
|
| |
|
| /* |
/* |
| * cli_Cmd_Exit() Builtin helper function for Exit from Cli |
* cli_Cmd_Exit() Builtin helper function for Exit from Cli |
| * @cmds = Commands list | * @buffer = CLI buffer |
| * @idx = Selected command ID |
* @idx = Selected command ID |
| * @out = Output handle |
|
| * @args = Parsed arguments array |
* @args = Parsed arguments array |
| * return: 1 exit from Cli! | * return: RETCODE_EOF exit from Cli! |
| */ |
*/ |
| int cli_Cmd_Exit(void *cmds, int idx, FILE *out, char ** __restrict args) | int cli_Cmd_Exit(void * __restrict buffer, int idx, char ** __restrict argv) |
| { |
{ |
| return 1; | cli_Printf(buffer, "\n"); |
| | return RETCODE_EOF; |
| } |
} |
| |
|
| /* |
/* |
|
Line 30 int cli_Cmd_Exit(void *cmds, int idx, FILE *out, char
|
Line 30 int cli_Cmd_Exit(void *cmds, int idx, FILE *out, char
|
| * @args = Parsed arguments array |
* @args = Parsed arguments array |
| * return: -1 error, 0 = ok |
* return: -1 error, 0 = ok |
| */ |
*/ |
| |
/* |
| int cli_Cmd_Help(void *cmds, int idx, FILE *out, char ** __restrict args) |
int cli_Cmd_Help(void *cmds, int idx, FILE *out, char ** __restrict args) |
| { |
{ |
| register int i; |
register int i; |
|
Line 60 int cli_Cmd_Help(void *cmds, int idx, FILE *out, char
|
Line 61 int cli_Cmd_Help(void *cmds, int idx, FILE *out, char
|
| |
|
| return 0; |
return 0; |
| } |
} |
| |
*/ |
| |
|
| /* |
/* |
| * cli_Cmd_Unsupported() Builtin helper function for unsupported commands |
* cli_Cmd_Unsupported() Builtin helper function for unsupported commands |
|
Line 71 int cli_Cmd_Help(void *cmds, int idx, FILE *out, char
|
Line 73 int cli_Cmd_Help(void *cmds, int idx, FILE *out, char
|
| */ |
*/ |
| int cli_Cmd_Unsupported(void *cmds, int idx, FILE *out, char ** __restrict args) |
int cli_Cmd_Unsupported(void *cmds, int idx, FILE *out, char ** __restrict args) |
| { |
{ |
| cli_Printf(out, "Command %s not supported in this version ...\n", args[0]); | // cli_Printf(out, "Command %s not supported in this version ...\n", args[0]); |
| return 0; |
return 0; |
| } |
} |
| |
|
| // ------------------------------------------------------------ |
|
| |
|
| /* |
|
| * cli_Comp_Filename() Builtin helper function for filename completion arguments |
|
| * @text = Text line |
|
| * @state = Position state |
|
| * return: NULL not found filename, != NULL filename |
|
| */ |
|
| char *cli_Comp_Filename(const char *text, int state) |
|
| { |
|
| return rl_filename_completion_function(text, state); |
|
| } |
|
| |
|
| |
|
| // ------------------------------------------------------------ |
|
| |
|
| /* |
|
| * cli_PrintHelp() Helper print for missing command arguments |
|
| * @out = Output stream |
|
| * @cmds = Commands list |
|
| * @idx = Selected command ID |
|
| * return: -1 error, !=-1 ok |
|
| * return: none |
|
| */ |
|
| inline int cli_PrintHelp(FILE *out, void *cmds, int idx) |
|
| { |
|
| cliCommands_t *c = cmds; |
|
| |
|
| return cli_Printf(out, "%s\n", c[idx].cmd_help); |
|
| } |
|
| |
|