summaryrefslogtreecommitdiffstats
path: root/mbbsd/name.c
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-07-05 22:52:26 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-07-05 22:52:26 +0800
commit1bbc108350cce991c081015da516ad230aa8fe58 (patch)
treeaed3172e26c0fb127c1ba3a143ecf48d5bc51e45 /mbbsd/name.c
parent1347f95d83b908cd4e61904154feed6ae9ab7389 (diff)
downloadpttbbs-1bbc108350cce991c081015da516ad230aa8fe58.tar
pttbbs-1bbc108350cce991c081015da516ad230aa8fe58.tar.gz
pttbbs-1bbc108350cce991c081015da516ad230aa8fe58.tar.bz2
pttbbs-1bbc108350cce991c081015da516ad230aa8fe58.tar.lz
pttbbs-1bbc108350cce991c081015da516ad230aa8fe58.tar.xz
pttbbs-1bbc108350cce991c081015da516ad230aa8fe58.tar.zst
pttbbs-1bbc108350cce991c081015da516ad230aa8fe58.zip
Change Vector_search
fix namecomplete case error git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4385 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/name.c')
-rw-r--r--mbbsd/name.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mbbsd/name.c b/mbbsd/name.c
index cae27f1b..131b4d67 100644
--- a/mbbsd/name.c
+++ b/mbbsd/name.c
@@ -15,7 +15,7 @@ ToggleVector(struct Vector *list, int *recipient, const char *listfile, const ch
if (space) *space = '\0';
if (!genbuf[0])
continue;
- if (!Vector_search(list, genbuf)) {
+ if (Vector_search(list, genbuf) < 0) {
Vector_add(list, genbuf);
(*recipient)++;
} else {
@@ -70,6 +70,7 @@ static int
nc_cb_peek(int key, VGET_RUNTIME *prt, void *instance)
{
struct namecomplete_int * nc_int = (struct namecomplete_int *) instance;
+ int tmp;
prt->buf[prt->iend] = 0;
@@ -83,7 +84,9 @@ nc_cb_peek(int key, VGET_RUNTIME *prt, void *instance)
case KEY_ENTER:
if (Vector_length(&nc_int->sublist) == 1)
strlcpy(prt->buf, Vector_get(&nc_int->sublist, 0), prt->len);
- else if (!Vector_search(&nc_int->sublist, prt->buf))
+ else if ((tmp = Vector_search(&nc_int->sublist, prt->buf)) >= 0)
+ strlcpy(prt->buf, Vector_get(&nc_int->sublist, tmp), prt->len);
+ else
prt->buf[0] = '\0';
prt->icurr = prt->iend = strlen(prt->buf);
break;