CMDList: separate command name from comand object for alias

This commit is contained in:
Laila van Reenen 2024-04-12 18:32:39 +02:00
parent c9fdbac547
commit 64a72b70ef
2 changed files with 5 additions and 5 deletions

View File

@ -36,15 +36,15 @@ int CMDList_deinit(CMDList_t *list)
} }
// add a command in the command tree // 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; int returnCode = 0;
char* read_p = cmd->cmd; char* read_p = cmdName;
CMDList_t** list_p = (CMDList_t**)list; CMDList_t** list_p = (CMDList_t**)list;
if (read_p == NULL) if (read_p == NULL)
{ // cmd is missing a string for the commnad name {
returnCode = -1; read_p = cmd->cmd;
} }
while (returnCode == 0) while (returnCode == 0)

View File

@ -46,7 +46,7 @@ extern CMDList_t* CMDList_init();
extern int CMDList_deinit(CMDList_t *list); extern int CMDList_deinit(CMDList_t *list);
// add a command in the command tree // 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 // search command in the tree
extern CMD_t* CMDList_get(CMDList_t *list, char* cmd); extern CMD_t* CMDList_get(CMDList_t *list, char* cmd);