command_parser()
#
Parse a command and its arguments based on a predefined command structure.
Prototype
PUBLIC int command_parser(
const char *command_line,
const char *commands[],
int (*callback)(const char *command, const char *args, void *user_data),
void *user_data
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The full command line input to parse. |
|
|
An array of valid command strings. |
|
|
A function pointer to process each parsed command and its arguments. |
|
|
User-defined data passed to the callback function. |
Return Value
Returns 0
on success, or a negative value on failure.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples