mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:43:04 +00:00
Create a branch for network fixes.
svn path=/branches/aicom-network-fixes/; revision=34994
This commit is contained in:
parent
0e213bbc00
commit
c501d8112c
18148 changed files with 0 additions and 860488 deletions
71
lib/sdk/crt/wstring/wcstok.c
Normal file
71
lib/sdk/crt/wstring/wcstok.c
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crt/??????
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
wchar_t** _wlasttoken(); /* wlasttok.c */
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
wchar_t *wcstok(wchar_t *s, const wchar_t *ct)
|
||||
{
|
||||
const wchar_t *spanp;
|
||||
int c, sc;
|
||||
wchar_t *tok;
|
||||
#if 1
|
||||
wchar_t ** wlasttoken = _wlasttoken();
|
||||
#else
|
||||
PTHREADDATA ThreadData = GetThreadData();
|
||||
wchar_t ** wlasttoken = &ThreadData->wlasttoken;
|
||||
#endif
|
||||
|
||||
if (s == NULL && (s = *wlasttoken) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Skip (span) leading ctiters (s += strspn(s, ct), sort of).
|
||||
*/
|
||||
cont:
|
||||
c = *s;
|
||||
s++;
|
||||
for (spanp = ct; (sc = *spanp) != 0;spanp++) {
|
||||
if (c == sc)
|
||||
goto cont;
|
||||
}
|
||||
|
||||
if (c == 0) { /* no non-ctiter characters */
|
||||
*wlasttoken = NULL;
|
||||
return (NULL);
|
||||
}
|
||||
tok = s - 1;
|
||||
|
||||
/*
|
||||
* Scan token (scan for ctiters: s += strcspn(s, ct), sort of).
|
||||
* Note that ct must have one NUL; we stop if we see that, too.
|
||||
*/
|
||||
for (;;) {
|
||||
c = *s;
|
||||
s++;
|
||||
spanp = ct;
|
||||
do {
|
||||
if ((sc = *spanp) == c) {
|
||||
if (c == 0)
|
||||
s = NULL;
|
||||
else
|
||||
s[-1] = 0;
|
||||
*wlasttoken = s;
|
||||
return (tok);
|
||||
}
|
||||
spanp++;
|
||||
} while (sc != 0);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue