From b880db8491271b4bd4aa87c2dd79b5e3c3dde6cf Mon Sep 17 00:00:00 2001 From: watcherhd Date: Thu, 17 Nov 2011 18:46:23 +0000 Subject: added: ieview, imo2sproxy, skype git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@175 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- skype/util.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 skype/util.c (limited to 'skype/util.c') diff --git a/skype/util.c b/skype/util.c new file mode 100644 index 0000000..ce5ad9c --- /dev/null +++ b/skype/util.c @@ -0,0 +1,57 @@ +#include + +char * __cdecl strtok_r ( + char * string, + const char * control, + char **nextoken + ) +{ + unsigned char *str; + const unsigned char *ctrl = (const unsigned char*)control; + + unsigned char map[32]; + int count; + + /* Clear control map */ + for (count = 0; count < 32; count++) + map[count] = 0; + + /* Set bits in delimiter table */ + do { + map[*ctrl >> 3] |= (1 << (*ctrl & 7)); + } while (*ctrl++); + + /* Initialize str. If string is NULL, set str to the saved + * pointer (i.e., continue breaking tokens out of the string + * from the last strtok call) */ + if (string) + str = (unsigned char*)string; + else + str = (unsigned char*)(*nextoken); + + /* Find beginning of token (skip over leading delimiters). Note that + * there is no token iff this loop sets str to point to the terminal + * null (*str == '\0') */ + while ( (map[*str >> 3] & (1 << (*str & 7))) && *str ) + str++; + + string = (char*)str; + + /* Find the end of the token. If it is not the end of the string, + * put a null there. */ + for ( ; *str ; str++ ) + if ( map[*str >> 3] & (1 << (*str & 7)) ) { + *str++ = '\0'; + break; + } + + /* Update nextoken (or the corresponding field in the per-thread data + * structure */ + *nextoken = (char*)str; + + /* Determine if a token has been found. */ + if ( string == (char*)str ) + return NULL; + else + return string; +} -- cgit v1.2.3