コード例 #1
0
ファイル: namecomplete.c プロジェクト: erichuang1994/fbbs
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;
}
コード例 #2
0
ファイル: name.c プロジェクト: YanlongLai/Program
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;
}
コード例 #3
0
ファイル: bcache.c プロジェクト: madoldman/inankai_bbs
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];
}
コード例 #4
0
ファイル: name.c プロジェクト: YanlongLai/Program
int chkstr(char *otag, char *tag, char *name) {
    char ch, *oname = name;

    while(*tag) {
	ch = *name++;
	if(*tag != chartoupper(ch))
	    return 0;
	tag++;
    }
    if(*tag && *name == '\0')
	strcpy(otag, oname);
    return 1;
}
コード例 #5
0
ファイル: namecomplete.c プロジェクト: erichuang1994/fbbs
int UserSubArray(char cwbuf[][IDLEN + 1], char cwlist[][IDLEN + 1],
		int cwnum, int key, int pos) {
	int key2, num = 0;
	int n, ch;
	key = chartoupper (key);
	if (key >= 'A' && key <= 'Z') {
		key2 = key - 'A' + 'a';
	} else {
		key2 = key;
	}
	for (n = 0; n < cwnum; n++) {
		ch = cwlist[n][pos];
		if (ch == key || ch == key2) {
			strcpy(cwbuf[num++], cwlist[n]);
		}
	}
	return num;
}
コード例 #6
0
ファイル: name.c プロジェクト: YanlongLai/Program
static int UserSubArray(char cwbuf[][IDLEN + 1], char cwlist[][IDLEN + 1],
			int cwnum, int key, int pos) {
    int key2, num = 0;
    int n, ch;

    key = chartoupper(key);
    if(key >= 'A' && key <= 'Z')
	key2 = key | 0x20;
    else
	key2 = key ;

    for(n = 0; n < cwnum; n++) {
	ch = cwlist[n][pos];
	if(ch == key || ch == key2)
	    strcpy(cwbuf[num++], cwlist[n]);
    }
    return num;
}
コード例 #7
0
ファイル: vector.c プロジェクト: ptt/pttbbs
int
Vector_match(const struct Vector *src, struct Vector *dst, const int key, const int pos)
{
    int uckey, lckey;
    int i;

    Vector_clear(dst, src->size);

    uckey = chartoupper(key);
    if (key >= 'A' && key <= 'Z')
	lckey = key | 0x20;
    else
	lckey = key;

    for (i=0; i<src->length; i++) {
	int ch = src->base[src->size * i + pos];
	if (ch == lckey || ch == uckey)
	    Vector_add(dst, src->base + src->size * i);
    }

    return dst->length;
}