When execute command, the adapter receive char *arg but must be a list of words.
This can be solved convert this unique sentence of string to a matrix of strings. char *str to char **strgs for example.
Can be a Matrix, Linked list, Array ...
Example of standard commands strtok this command convert string to token
// If str is not NULL, start from the beginning
if (str != NULL)
last = str;
// If last is NULL, there are no more tokens
if (last == NULL)
return NULL;
// Skip leading delimiters
last += strspn(last, delim);
// If last points to the end of the string, there are no more tokens
if (*last == '\0')
return NULL;
// Find the end of the current token
token = last;
last = strpbrk(last, delim);
if (last != NULL) {
// If a delimiter is found, replace it with a null terminator
*last = '\0';
last++;
}
return token;
When execute command, the adapter receive
char *arg
but must be a list of words. This can be solved convert this unique sentence of string to a matrix of strings.char *str
tochar **strgs
for example.Can be a Matrix, Linked list, Array ...
Example of standard commands
strtok
this command convert string to tokeninclude
include
char strtok_custom(char str, const char delim) { static char last = NULL; char *token;
}