/* show all command */ int ShowAllMenuItem(tLinkTable* head) { tMenuItem* pNode = (tMenuItem*)GetLinkTableHead(head); while(pNode != NULL) { printf("%s - %s\n", pNode->cmd, pNode->desc); pNode = (tMenuItem*)GetNextLinkTableNode(head,(tLinkTableNode *)pNode); } return 0; }
/* show all commands */ int FindAllCmd(tLinkTable * head) { tDataNode * pNode = (tDataNode*)GetLinkTableHead(head); while(pNode != NULL) { printf("%s - %s\n", pNode->cmd, pNode->desc); pNode = (tDataNode*)GetNextLinkTableNode(head,(tLinkTableNode *)pNode); } return 0; }
int ShowAllCmd(tLinkTable * pLinkTable) { printf("*****************************************\n"); printf("Menu List: \n"); tDataNode *pNode = (tDataNode *)GetLinkTableHead(pLinkTable); while(pNode != NULL) { printf(" %s, %s\n", pNode->cmd, pNode->desc); pNode = (tDataNode *)GetNextLinkTableNode(pLinkTable,(tLinkTableNode *)pNode); } printf("*****************************************\n"); return 0; }
/* search MenuItem*/ tMenuItem* SearchMenuItem(tLinkTable* head, char* cmd) { tMenuItem* pNode = (tMenuItem*)GetLinkTableHead(head); while(pNode != NULL) { if(!strcmp(pNode->cmd, cmd)) { return pNode; } pNode = (tMenuItem*)GetNextLinkTableNode(head, (tLinkTableNode *)pNode); } return NULL; }
/* find a cmd in the linklist and return the datanode pointer */ tDataNode* FindCmd(tLinkTable * head, char * cmd) { tDataNode * pNode = (tDataNode*)GetLinkTableHead(head); while(pNode != NULL) { if(!strcmp(pNode->cmd, cmd)) { return pNode; } pNode = (tDataNode*)GetNextLinkTableNode(head,(tLinkTableNode *)pNode); } return NULL; }
tNode * Search(tLinkTable *pLinkTable) { debug("Search GetLinkTableHead\n"); tNode * pNode = (tNode*)GetLinkTableHead(pLinkTable); while(pNode != NULL) { if(pNode->data == 5) { return pNode; } debug("GetNextLinkTableNode\n"); pNode = (tNode*)GetNextLinkTableNode(pLinkTable,(tLinkTableNode *)pNode); } return NULL; }
/* Check whether cmd existed */ int CheckCmdExist(char * cmd) { if(head == NULL || cmd == NULL) { return FAILURE; } tDataNode * pNode = (tDataNode*)GetLinkTableHead(head); while(pNode != NULL) { if(!strcmp(pNode->cmd, cmd)) { return SUCCESS; } pNode = (tDataNode*)GetNextLinkTableNode(head,(tLinkTableNode *)pNode); } return FAILURE; }
tDataNode* FindCmd(tLinkTable * pLinkTable, char *cmd) { //printf("%s",cmd); if((pLinkTable == NULL)||(cmd == NULL)) { return NULL; } tDataNode *pNode = (tDataNode *)GetLinkTableHead(pLinkTable); while(pNode != NULL) { if(!strcmp(pNode->cmd, cmd)) { return pNode; } pNode = (tDataNode *)GetNextLinkTableNode(pLinkTable,(tLinkTableNode *)pNode); } return NULL; }