Moved shared crtdll/ntdll functions into ntdll.
[wine.git] / dlls / crtdll / mbstring.c
blob5eacca39d9f196cca63e360f9ab1eb49528911d6
1 /*
2 * CRTDLL multi-byte string functions
4 * Copyright 1999 Alexandre Julliard
5 */
7 #include "config.h"
9 #include <ctype.h>
10 #include <limits.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #ifdef HAVE_WCTYPE_H
14 #include <wctype.h>
15 #endif
17 #include "windef.h"
18 #include "crtdll.h"
21 /*********************************************************************
22 * CRTDLL__mbsinc (CRTDLL.205)
24 LPSTR __cdecl CRTDLL__mbsinc( LPCSTR str )
26 int len = mblen( str, MB_LEN_MAX );
27 if (len < 1) len = 1;
28 return (LPSTR)(str + len);
32 /*********************************************************************
33 * CRTDLL__mbslen (CRTDLL.206)
35 INT __cdecl CRTDLL__mbslen( LPCSTR str )
37 INT len, total = 0;
38 while ((len = mblen( str, MB_LEN_MAX )) > 0)
40 str += len;
41 total++;
43 return total;
47 /*********************************************************************
48 * CRTDLL_mbtowc (CRTDLL.430)
50 INT __cdecl CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n )
52 wchar_t res;
53 int ret = mbtowc( &res, str, n );
54 if (dst) *dst = (WCHAR)res;
55 return ret;