Go to the source code of this file.
Defines | |
#define | ARGV_SIZE 128 |
Functions | |
char * | kb_get_arg (char *cmd, unsigned arg) |
int | kb_parse_command (char *line, kb_command_t *cmds, void *data) |
int | kb_find_command (const char *cmd_name, const kb_command_t *cmd_list) |
int | kb_find_string (const char *str, const char **list) |
Command Parser
Definition in file kb_cmdparser.c.
#define ARGV_SIZE 128 |
Maximal number of arguments
Definition at line 27 of file kb_cmdparser.c.
Referenced by kb_get_arg(), and kb_parse_command().
int kb_find_command | ( | const char * | cmd_name, | |
const kb_command_t * | cmd_list | |||
) |
This function finds a command in an array of command_s
cmd_name | Pointer to the command name. | |
cmd_list | Pointer to the array of commands. |
Definition at line 165 of file kb_cmdparser.c.
References KB_ERROR, KB_ERROR_UNKCMD, and kb_command_s::name.
Referenced by ksock_remove_command().
int kb_find_string | ( | const char * | str, | |
const char ** | list | |||
) |
This function finds a string in an array of strings
str | Pointer to the string to search in the array. | |
list | Pointer to the array of strings. |
Definition at line 190 of file kb_cmdparser.c.
Referenced by kb_parse_device(), and kb_parse_modbus().
char* kb_get_arg | ( | char * | cmd, | |
unsigned | arg | |||
) |
return the given argument from the given command string.
cmd | the command string | |
arg | the argument to find |
Definition at line 36 of file kb_cmdparser.c.
int kb_parse_command | ( | char * | line, | |
kb_command_t * | cmds, | |||
void * | data | |||
) |
This function parses a given command line and executes commands found in a given command descriptor table.
line | Pointer to the command line. | |
cmds | Pointer to an array of command descriptor | |
data | Pointer to additional data that the application may need to pass to the command |
Definition at line 79 of file kb_cmdparser.c.
References ARGV_SIZE, kb_error(), KB_ERROR, KB_ERROR_CMDARGMAX, KB_ERROR_CMDARGMIN, KB_ERROR_INVAL, KB_ERROR_TOOMANYARGS, KB_ERROR_UNKCMD, and kb_command_s::name.
Referenced by kb_parse_config_file(), ksock_exec_command(), ksock_exec_command_pending(), and main().