diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-02 07:57:17 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-02 07:57:17 +0000 |
commit | 90c4dae08fea47797b3ae574e5dfe35dc66f5631 (patch) | |
tree | 4198e3ccd0a5bab17db2a0f82ee7b6c643115c69 /wince/string.c | |
parent | e193fd8d665567c7f3b827c21a1b77af43e2c391 (diff) | |
download | ruby-90c4dae08fea47797b3ae574e5dfe35dc66f5631.tar.gz |
WinCE patch merged
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'wince/string.c')
-rw-r--r-- | wince/string.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/wince/string.c b/wince/string.c new file mode 100644 index 0000000000..eb95d94d47 --- /dev/null +++ b/wince/string.c @@ -0,0 +1,71 @@ +/*************************************************************** + string.c +***************************************************************/ + +#include <windows.h> +#include "wince.h" /* for wce_mbtowc */ + +extern char* rb_w32_strerror(int errno); + +/* _strdup already exists in stdlib.h? */ +char *strdup(const char * str) +{ + char *p; + + p = malloc( strlen(str)+1 ); + strcpy( p, str ); + return p; +} + +/* strerror shoud replace with rb_w32_strerror. */ +char* strerror(int errno) +{ + return rb_w32_strerror(errno); +} + +/* _strnicmp already exists in stdlib.h? */ +int _strnicmp( const char *s1, const char *s2, size_t count ) +{ + wchar_t *w1, *w2; + int n; + + w1 = wce_mbtowc(s1); + w2 = wce_mbtowc(s2); + + n = wcsnicmp(w1, w2, count); + + free(w1); + free(w2); + + return n; +} + +#if _WIN32_WCE < 300 +#include "..\missing\strtoul.c" + +char *strrchr( const char *p, int c ) +{ + char *pp; + for( pp=(char*)p+strlen(p); pp!=p; p-- ) + { + if( *pp==c ) break; + } + return pp==p ? NULL : pp; +} + +int _stricmp( const char *s1, const char *s2 ) +{ + wchar_t *w1, *w2; + int n; + + w1 = wce_mbtowc(s1); + w2 = wce_mbtowc(s2); + + n = wcsicmp(w1, w2); + + free(w1); + free(w2); + + return n; +} +#endif |