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 | 4d6d2ae1b417133546c56b3150ef51fa7647e2dc (patch) | |
| tree | 4198e3ccd0a5bab17db2a0f82ee7b6c643115c69 /wince/string.c | |
| parent | 1668ec3e5ce555161454e9b2657c89dc27fa1364 (diff) | |
| download | ruby-4d6d2ae1b417133546c56b3150ef51fa7647e2dc.tar.gz ruby-4d6d2ae1b417133546c56b3150ef51fa7647e2dc.tar.xz ruby-4d6d2ae1b417133546c56b3150ef51fa7647e2dc.zip | |
WinCE patch merged
git-svn-id: http://svn.ruby-lang.org/repos/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 000000000..eb95d94d4 --- /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 |
