X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=win%2Finspircd_win32wrapper.cpp;h=03d89a7aa5a8f0b932d7cf77e61dadf009f027a7;hb=de6551f6350206c036b7a91b1b13c8d1a523e522;hp=7e72220e858d6bcebeb204cd94f7f83eddccda0f;hpb=696e90acdb29aea08a4bd6f2196efd1e9824f946;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp index 7e72220e8..03d89a7aa 100644 --- a/win/inspircd_win32wrapper.cpp +++ b/win/inspircd_win32wrapper.cpp @@ -91,71 +91,6 @@ int inet_pton(int af, const char *src, void *dst) return rv; } -char * strtok_r(char *_String, const char *_Control, char **_Context) -{ - unsigned char *str; - const unsigned char *ctl = (const unsigned char*)_Control; - unsigned char map[32]; - - if (_Context == 0 || !_Control) - return 0; - - if (!(_String != NULL || *_Context != NULL)) - return 0; - - memset(map, 0, 32); - - do { - map[*ctl >> 3] |= (1 << (*ctl & 7)); - } while (*ctl++); - - /* 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 != NULL) - { - str = (unsigned char*)_String; - } - else - { - str = (unsigned char*)*_Context; - } - - /* 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 != 0) - { - 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 != 0 ; str++ ) - { - if (map[*str >> 3] & (1 << (*str & 7))) - { - *str++ = 0; - break; - } - } - - /* Update context */ - *_Context = (char*)str; - - /* Determine if a token has been found. */ - if (_String == (char*)str) - { - return NULL; - } - else - { - return _String; - } -} - void setcolor(int color_code) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color_code); @@ -776,3 +711,12 @@ int getcpu() pclsObj->Release(); return -1; } + +void usleep(unsigned long usecs) +{ + if (usecs > 0UL) + { + unsigned long millis = ((usecs + 999UL) / 1000UL); + SleepEx(millis, false); + } +}