42 lines
683 B
C

#include "CMDList.h"
// initilises a CMDList_t with all null pointers
CMDList_t* CMDList_init()
{
CMDList_t *list = malloc(sizeof(CMDList_t));
memset(list, 0, sizeof(CMDList_t));
return list;
}
// free up the full tree from memory
int CMDList_deinit(CMDList_t *list)
{
void* chars[26] = list;
for (int i = 0; i < 26; i++)
{
if (chars[i] != null)
{
CMDList_deinit(chars[i]);
}
}
free(list);
return 0;
}
// add a command in the command tree
int CMDList_add(CMDList_t *list, void* cmd)
{
char* read_p = cmd;
while ((*read_p != 0) && (read_p != ' ') && (read_p - cmd < 500))
{
}
}
// search command in the tree
int CMDList_get(CMDList_t *list, char* cmd);