summaryrefslogtreecommitdiffstats
path: root/common/sys
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-10 17:00:49 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-10 17:00:49 +0800
commitec550180fc86a91255b786e446399143f5c1b6ff (patch)
tree3c85f640fc89d46cb58664f628ea223ebe9482e7 /common/sys
parente2b6bacddae70d083142988bc6f19078aac26ceb (diff)
downloadpttbbs-ec550180fc86a91255b786e446399143f5c1b6ff.tar
pttbbs-ec550180fc86a91255b786e446399143f5c1b6ff.tar.gz
pttbbs-ec550180fc86a91255b786e446399143f5c1b6ff.tar.bz2
pttbbs-ec550180fc86a91255b786e446399143f5c1b6ff.tar.lz
pttbbs-ec550180fc86a91255b786e446399143f5c1b6ff.tar.xz
pttbbs-ec550180fc86a91255b786e446399143f5c1b6ff.tar.zst
pttbbs-ec550180fc86a91255b786e446399143f5c1b6ff.zip
- (internal) fix DBCS_strcasestr() API
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4291 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'common/sys')
-rw-r--r--common/sys/string.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/common/sys/string.c b/common/sys/string.c
index 8754e00c..02c5eb98 100644
--- a/common/sys/string.c
+++ b/common/sys/string.c
@@ -258,7 +258,8 @@ strip_nonebig5(unsigned char *str, int maxlen)
}
/**
- * DBCS_RemoveIntrEscape(buf, len): 去除 buf 中的一字雙色。
+ * DBCS_RemoveIntrEscape(buf, len): 去除 DBCS 一字雙色字。
+ * (deprecated)
*/
int DBCS_RemoveIntrEscape(unsigned char *buf, int *len)
{
@@ -322,7 +323,7 @@ int DBCS_RemoveIntrEscape(unsigned char *buf, int *len)
}
/**
- * DBCS_Status(dbcstr, pos): 傳回 dbcstr 中 pos 位置字元的狀態。
+ * DBCS_Status(dbcstr, pos): 取得字串中指定位置的 DBCS 狀態。
*/
int DBCS_Status(const char *dbcstr, int pos)
{
@@ -344,8 +345,10 @@ int DBCS_Status(const char *dbcstr, int pos)
return sts;
}
-// return: 1 - found, 0 - fail.
-int
+/**
+ * DBCS_strcasestr(pool, ptr): 在字串 pool 中尋找 ptr (只忽略英文大小寫)
+ */
+const char *
DBCS_strcasestr(const char* pool, const char *ptr)
{
int i = 0, i2 = 0, found = 0,
@@ -382,13 +385,14 @@ DBCS_strcasestr(const char* pool, const char *ptr)
}
}
- if (found) break;
+ if (found)
+ return pool+i;
// next iteration: if target is DBCS, skip one more byte.
if (pool[i] < 0)
i++;
}
- return found;
+ return NULL;
}
/* ----------------------------------------------------- */