update CMDList_get
This commit is contained in:
@@ -75,7 +75,7 @@ int CMDList_add(CMDList_t *list, CMD_t* cmd)
|
||||
}
|
||||
|
||||
// read next character
|
||||
read_p += 1;
|
||||
read_p++;
|
||||
}
|
||||
|
||||
if (returnCode >= 0)
|
||||
@@ -99,10 +99,11 @@ CMD_t* CMDList_get(CMDList_t *list, char* cmd)
|
||||
bool found = true;
|
||||
CMD_t* cmd_object = NULL;
|
||||
char* read_p = cmd;
|
||||
CMDList_t* list_p = list;
|
||||
CMDList_t** list_p = (CMDList_t**)list;
|
||||
|
||||
while (found)
|
||||
{
|
||||
//TODO: mayby make a copy before converting to upper case
|
||||
char c = *read_p & (~0x20); // convert to uppercase
|
||||
if ((c >= 'A') && (c <= 'Z'))
|
||||
{ // valid character
|
||||
@@ -110,14 +111,14 @@ CMD_t* CMDList_get(CMDList_t *list, char* cmd)
|
||||
// get memory address of the caracter in the CMDList
|
||||
list_p += (c - 'A');
|
||||
|
||||
if (*((CMDList_t**)list_p) == NULL)
|
||||
if (*list_p == NULL)
|
||||
{ // no command found
|
||||
found = false;
|
||||
}
|
||||
else
|
||||
{ // it points to an other list
|
||||
// update pointer to this list
|
||||
list_p = *((CMDList_t**)list_p);
|
||||
list_p = (CMDList_t**)(*list_p);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -126,19 +127,19 @@ CMD_t* CMDList_get(CMDList_t *list, char* cmd)
|
||||
}
|
||||
|
||||
// read next character
|
||||
read_p += sizeof(char);
|
||||
read_p++;
|
||||
}
|
||||
|
||||
if (found)
|
||||
{ // list found for command
|
||||
if (list_p->cmd == NULL)
|
||||
if (((CMDList_t*)list_p)->cmd == NULL)
|
||||
{ // command incomplete
|
||||
found = false;
|
||||
cmd_object = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd_object = list_p->cmd;
|
||||
cmd_object = ((CMDList_t*)list_p)->cmd;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user