first attampt at CMDList_add
This commit is contained in:
@@ -30,10 +30,30 @@ int CMDList_deinit(CMDList_t *list)
|
||||
int CMDList_add(CMDList_t *list, void* cmd)
|
||||
{
|
||||
char* read_p = cmd;
|
||||
CMDList_t* list_p = list;
|
||||
|
||||
while ((*read_p != 0) && (read_p != ' ') && (read_p - cmd < 500))
|
||||
while (
|
||||
(read_p != null)
|
||||
&& (*read_p != ' ') // space ends the command
|
||||
&& (*read_p != '\n') // end of line
|
||||
&& (*read_p != '\r') // end of line
|
||||
&& (*read_p != 0) // end of string
|
||||
&& (read_p - cmd < 500)
|
||||
)
|
||||
{
|
||||
|
||||
char c = *read_p & (~0x20); // to uppercase
|
||||
if ((*read_p >= 'A') && (*read_p <= 'Z'))
|
||||
{
|
||||
read_p += (read_p - 'A') * sizeof(CMDList_t*);
|
||||
if (*((CMDList_t**)read_p) == null)
|
||||
{
|
||||
read_p = malloc(sizeof(CMDList_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
read_p = *((CMDList_t**)read_p)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user