summaryrefslogtreecommitdiffstats
path: root/private/crt32/mbstring/mbslen.c
diff options
context:
space:
mode:
Diffstat (limited to 'private/crt32/mbstring/mbslen.c')
-rw-r--r--private/crt32/mbstring/mbslen.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/private/crt32/mbstring/mbslen.c b/private/crt32/mbstring/mbslen.c
new file mode 100644
index 000000000..fbea20ce8
--- /dev/null
+++ b/private/crt32/mbstring/mbslen.c
@@ -0,0 +1,51 @@
+/***
+*mbslen.c - Find length of MBCS string
+*
+* Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Find length of MBCS string
+*
+*Revision History:
+* 11-19-92 KRS Ported from 16-bit sources.
+*
+*******************************************************************************/
+
+#ifdef _MBCS
+#include <cruntime.h>
+#include <mbdata.h>
+#include <mbctype.h>
+#include <mbstring.h>
+
+
+/***
+* _mbslen - Find length of MBCS string
+*
+*Purpose:
+* Find the length of the MBCS string (in characters).
+*
+*Entry:
+* unsigned char *s = string
+*
+*Exit:
+* Returns the number of MBCS chars in the string
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+size_t _CRTAPI1 _mbslen(s)
+const unsigned char *s;
+{
+ int n;
+
+ for (n = 0; *s; n++, s++) {
+ if (_ISLEADBYTE(*s)) {
+ if (*++s == '\0')
+ break;
+ }
+ }
+
+ return(n);
+}
+#endif /* _MBCS */