mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
32bd3c5679
* wince/stdlib.c: fix mblen() bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
39 lines
701 B
C
39 lines
701 B
C
/***************************************************************
|
|
stdlib.c
|
|
***************************************************************/
|
|
|
|
#include <windows.h>
|
|
|
|
char **environ;
|
|
extern char * rb_w32_getenv(const char *);
|
|
|
|
/* getenv should replace with rb_w32_getenv. */
|
|
char *getenv(const char *env)
|
|
{
|
|
return rb_w32_getenv(env);
|
|
}
|
|
|
|
char *_fullpath(char *absPath, const char *relPath,
|
|
size_t maxLength)
|
|
{
|
|
strcpy( absPath, relPath );
|
|
return absPath;
|
|
}
|
|
|
|
int mblen(const char *mbstr, size_t count)
|
|
{
|
|
const char *p = mbstr;
|
|
size_t i;
|
|
int n=0;
|
|
|
|
for( i=0; i<count; i++ )
|
|
{
|
|
if( *p=='\0' ) break;
|
|
if( IsDBCSLeadByteEx( CP_ACP, *p ) )
|
|
n+=2, p+=2;
|
|
else
|
|
n+=1, p+=1;
|
|
}
|
|
|
|
return n;
|
|
}
|