summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-25 00:32:52 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-25 00:32:52 +0800
commitb2cec3d137c63449aab2e3fa1ff08d168972024a (patch)
treea68fea1b506d4a71d1fe519404a483b42166093d /mbbsd
parentc7526b201a879c48f52c4044b5310e00c6acd87c (diff)
downloadpttbbs-b2cec3d137c63449aab2e3fa1ff08d168972024a.tar
pttbbs-b2cec3d137c63449aab2e3fa1ff08d168972024a.tar.gz
pttbbs-b2cec3d137c63449aab2e3fa1ff08d168972024a.tar.bz2
pttbbs-b2cec3d137c63449aab2e3fa1ff08d168972024a.tar.lz
pttbbs-b2cec3d137c63449aab2e3fa1ff08d168972024a.tar.xz
pttbbs-b2cec3d137c63449aab2e3fa1ff08d168972024a.tar.zst
pttbbs-b2cec3d137c63449aab2e3fa1ff08d168972024a.zip
namecomplete return the position
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@194 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/name.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/mbbsd/name.c b/mbbsd/name.c
index a16e89e6..a48c7d32 100644
--- a/mbbsd/name.c
+++ b/mbbsd/name.c
@@ -1,4 +1,4 @@
-/* $Id: name.c,v 1.4 2002/05/11 16:42:45 in2 Exp $ */
+/* $Id: name.c,v 1.5 2002/05/24 16:32:52 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -522,17 +522,17 @@ int gnc_completeone(char *data, int start, int end,
}
if( count == 1 ){
strcpy(data, getname(at));
- return 1;
+ return at;
}
- return 0;
+ return -1;
}
-void generalnamecomplete(char *prompt, char *data, int len, size_t nmemb,
- int (*compar)(int, char *, int),
- int (*permission)(int), char* (*getname)(int))
+int generalnamecomplete(char *prompt, char *data, int len, size_t nmemb,
+ int (*compar)(int, char *, int),
+ int (*permission)(int), char* (*getname)(int))
{
- int x, y, origx, origy, ch, i, morelist = -1, col;
+ int x, y, origx, origy, ch, i, morelist = -1, col, ret;
int start, end, ptr;
int clearbot = NA;
@@ -554,8 +554,10 @@ void generalnamecomplete(char *prompt, char *data, int len, size_t nmemb,
outc('\n');
if( ptr != 0 ){
gnc_findbound(data, &start, &end, nmemb, compar);
- gnc_completeone(data, start, end, permission, getname);
+ ret = gnc_completeone(data, start, end, permission, getname);
}
+ else
+ ptr = -1;
break;
}
else if( ch == ' ' ){
@@ -565,7 +567,8 @@ void generalnamecomplete(char *prompt, char *data, int len, size_t nmemb,
if( morelist == -1 ){
if( gnc_findbound(data, &start, &end, nmemb, compar) == -1 )
continue;
- if( gnc_completeone(data, start, end, permission, getname) ){
+ if( gnc_completeone(data, start, end,
+ permission, getname) >= 0 ){
move(origy, origx);
outs(data);
ptr = strlen(data);
@@ -646,6 +649,7 @@ void generalnamecomplete(char *prompt, char *data, int len, size_t nmemb,
outs(data);
outc('\n');
}
+ return ret;
}
/* general complete functions (brdshm) */