summaryrefslogtreecommitdiffstats
path: root/common/sys/string.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-17 09:47:43 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-17 09:47:43 +0800
commit9e11577128c92707c2db3f3e44814a3be0d7bf6f (patch)
tree25d438fbc3009315f1d9c54764225325921a2ccc /common/sys/string.c
parente20bd69d66148c34fee47e1f1f372963a871c047 (diff)
downloadpttbbs-9e11577128c92707c2db3f3e44814a3be0d7bf6f.tar
pttbbs-9e11577128c92707c2db3f3e44814a3be0d7bf6f.tar.gz
pttbbs-9e11577128c92707c2db3f3e44814a3be0d7bf6f.tar.bz2
pttbbs-9e11577128c92707c2db3f3e44814a3be0d7bf6f.tar.lz
pttbbs-9e11577128c92707c2db3f3e44814a3be0d7bf6f.tar.xz
pttbbs-9e11577128c92707c2db3f3e44814a3be0d7bf6f.tar.zst
pttbbs-9e11577128c92707c2db3f3e44814a3be0d7bf6f.zip
- (internal) visio: add vgets
- (internal) add key name KEY_BS2 - (internal) move getDBCSstatus to DBCS_Status git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4174 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'common/sys/string.c')
-rw-r--r--common/sys/string.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/common/sys/string.c b/common/sys/string.c
index 881a0e04..908f1fb4 100644
--- a/common/sys/string.c
+++ b/common/sys/string.c
@@ -311,6 +311,26 @@ int DBCS_RemoveIntrEscape(unsigned char *buf, int *len)
return (oldl != l) ? 1 : 0;
}
+int DBCS_Status(const char *dbcstr, int pos)
+{
+ int sts = DBCS_ASCII;
+ const unsigned char *s = (const unsigned char*)dbcstr;
+
+ while(pos >= 0)
+ {
+ if(sts == DBCS_LEADING)
+ sts = DBCS_TRAILING;
+ else if (*s >= 0x80)
+ {
+ sts = DBCS_LEADING;
+ } else {
+ sts = DBCS_ASCII;
+ }
+ s++, pos--;
+ }
+ return sts;
+}
+
/* ----------------------------------------------------- */
/* 字串檢查函數:英文、數字、檔名、E-mail address */
/* ----------------------------------------------------- */