* transcode_data.h (rb_trans_elem_t): new field: from and to.
[ruby-svn.git] / wince / stdlib.c
blobd371b12f88e280baca2e894cc1786b9bf4e72ee3
1 /***************************************************************
2 stdlib.c
3 ***************************************************************/
5 #include <windows.h>
7 char **environ;
8 extern char * rb_w32_getenv(const char *);
10 /* getenv should replace with rb_w32_getenv. */
11 char *getenv(const char *env)
13 return rb_w32_getenv(env);
16 char *_fullpath(char *absPath, const char *relPath,
17 size_t maxLength)
19 strcpy( absPath, relPath );
20 return absPath;
23 int mblen(const char *mbstr, size_t count)
25 const char *p = mbstr;
26 size_t i;
27 int n=0;
29 for( i=0; i<count; i++ )
31 if( *p=='\0' ) break;
32 if( IsDBCSLeadByteEx( CP_ACP, *p ) )
33 n+=2, p+=2;
34 else
35 n+=1, p+=1;
38 return n;
41 void *bsearch( const void *key, const void *base,
42 size_t num, size_t width,
43 int ( __cdecl *compare )(const void *, const void *))
45 size_t i;
46 const void* p = base;
47 const char* px;
49 for( i=0; i<num; i++ )
51 if( 0==compare( key, p ) )
52 return (void*)p;
53 px = (const char*)p; px+=width; p=(const void*)px;
55 return NULL;