diff --git a/CMDList/CMDList.c b/CMDList/CMDList.c index ff9cca1..19c8639 100644 --- a/CMDList/CMDList.c +++ b/CMDList/CMDList.c @@ -36,15 +36,15 @@ int CMDList_deinit(CMDList_t *list) } // add a command in the command tree -int CMDList_add(CMDList_t *list, CMD_t* cmd) +int CMDList_add(CMDList_t *list, CMD_t* cmd, char* cmdName) { int returnCode = 0; - char* read_p = cmd->cmd; + char* read_p = cmdName; CMDList_t** list_p = (CMDList_t**)list; if (read_p == NULL) - { // cmd is missing a string for the commnad name - returnCode = -1; + { + read_p = cmd->cmd; } while (returnCode == 0) diff --git a/CMDList/CMDList.h b/CMDList/CMDList.h index df580c8..e6d3bff 100644 --- a/CMDList/CMDList.h +++ b/CMDList/CMDList.h @@ -46,7 +46,7 @@ extern CMDList_t* CMDList_init(); extern int CMDList_deinit(CMDList_t *list); // add a command in the command tree -extern int CMDList_add(CMDList_t *list, CMD_t* cmd); +extern int CMDList_add(CMDList_t *list, CMD_t* cmd, char* cmdName); // search command in the tree extern CMD_t* CMDList_get(CMDList_t *list, char* cmd);