static word_t *GetSubList(char *tag, word_t *list) { word_t *wlist, *wcurr; char tagbuf[STRLEN]; int n; wlist = wcurr = NULL; for(n = 0; tag[n]; n++) tagbuf[n] = chartoupper(tag[n]); tagbuf[n] = '\0'; while(list) { if(chkstr(tag, tagbuf, list->word)) { register word_t *node; node = (word_t *)malloc(sizeof(word_t)); node->word = list->word; node->next = NULL; if(wlist) wcurr->next = node; else wlist = node; wcurr = node; } list = list->next; } return wlist; }
struct word * GetSubList(register char *tag, register struct word *list) { struct word *wlist, *wcurr; char tagbuf[STRLEN]; int n; wlist = NULL; wcurr = NULL; for (n = 0; tag[n] != '\0'; n++) { tagbuf[n] = chartoupper (tag[n]); } tagbuf[n] = '\0'; while (list != NULL) { if (chkstr(tag, tagbuf, list->name)) { register struct word *node; node = (struct word *) malloc(sizeof(struct word)); node->name = list->name; node->next = NULL; if (wlist) wcurr->next = node; else wlist = node; wcurr = node; } list = list->next; } return wlist; }
char* u_namearray(char buf[][IDLEN + 1], int* pnum, char* tag) { register struct UCACHE *reg_ushm = uidshm; register char *ptr, tmp; register int n, total; char tagbuf[STRLEN]; int ch, num = 0; resolve_ucache(); if (*tag == '\0') { *pnum = reg_ushm->number; return reg_ushm->userid[0]; } for (n = 0; tag[n] != '\0'; n++) { tagbuf[n] = chartoupper(tag[n]); } tagbuf[n] = '\0'; ch = tagbuf[0]; total = reg_ushm->number; for (n = 0; n < total; n++) { ptr = reg_ushm->userid[n]; tmp = *ptr; if (tmp == ch || tmp == ch - 'A' + 'a') if (chkstr(tag, tagbuf, ptr)) strcpy(buf[num++], ptr); } *pnum = num; return buf[0]; }