Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
966 B

  1. #include <windows.h>
  2. #include <sdsutils.h>
  3. // If the next token in *pszData is delimited by the DeLim char, replace DeLim
  4. // in *pszData by chEos, set *pszData to point to the char after the chEos and return
  5. // ptr to the beginning of the token; otherwise, return NULL
  6. PSTR GetNextToken( PSTR *pszData, char DeLim)
  7. {
  8. PSTR szPos;
  9. if ( (pszData == NULL) || (*pszData == NULL) || (**pszData == '\0') )
  10. return NULL;
  11. if ((szPos = ANSIStrChr( *pszData, DeLim ) ) != NULL)
  12. {
  13. PSTR szT = *pszData;
  14. // replace DeLim with the chEos char
  15. *szPos = '\0';
  16. *pszData = szPos + 1;
  17. szPos = szT;
  18. }
  19. else
  20. {
  21. // DeLim not found; set *pszData to point to
  22. // to the end of szData; the next invocation
  23. // of this function would return NULL
  24. szPos = *pszData;
  25. *pszData = szPos + lstrlen(szPos);
  26. }
  27. return szPos;
  28. }