summaryrefslogtreecommitdiffstats
path: root/private/crt32/mbstring/mbsbtype.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crt32/mbstring/mbsbtype.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/crt32/mbstring/mbsbtype.c')
-rw-r--r--private/crt32/mbstring/mbsbtype.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/private/crt32/mbstring/mbsbtype.c b/private/crt32/mbstring/mbsbtype.c
new file mode 100644
index 000000000..cd87b273a
--- /dev/null
+++ b/private/crt32/mbstring/mbsbtype.c
@@ -0,0 +1,64 @@
+/***
+*mbsbtype.c - Return type of byte within a string (MBCS)
+*
+* Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Return type of byte within a string (MBCS)
+*
+*Revision History:
+* 11-19-92 KRS Ported from 16-bit sources.
+*
+*******************************************************************************/
+
+#ifdef _MBCS
+#include <cruntime.h>
+#include <mbdata.h>
+#include <mbstring.h>
+#include <mbctype.h>
+
+#define _MBBTYPE(p,c) _mbbtype(p,c)
+
+/***
+* _mbsbtype - Return type of byte within a string
+*
+*Purpose:
+* Test byte within a string for MBCS char type.
+* This function requires the start of the string because
+* context must be taken into account.
+*
+*Entry:
+* const unsigned char *string = pointer to string
+* size_t len = position of the char in string
+*
+*Exit:
+* returns one of the following values:
+*
+* _MBC_LEAD = if 1st byte of MBCS char
+* _MBC_TRAIL = if 2nd byte of MBCS char
+* _MBC_SINGLE = valid single byte char
+*
+* _MBC_ILLEGAL = if illegal char
+*
+*Exceptions:
+* returns _MBC_ILLEGAL if len is bigger than string length
+*
+*******************************************************************************/
+
+int _CRTAPI1 _mbsbtype( string, len )
+const unsigned char *string;
+size_t len;
+{
+ int chartype = _MBC_ILLEGAL;
+
+ do {
+ if (*string == '\0')
+ return(_MBC_ILLEGAL);
+
+ chartype = _MBBTYPE(*string++, chartype);
+
+ } while (len--);
+
+ return(chartype);
+}
+#endif /* _MBCS */