Added StrSep function.

This commit is contained in:
Armin Novak 2015-06-09 15:32:50 +02:00
parent 07407927c2
commit d6e1a0a25f
2 changed files with 21 additions and 0 deletions

View File

@ -186,6 +186,8 @@ WINPR_API void ByteSwapUnicode(WCHAR* wstr, int length);
WINPR_API int ConvertLineEndingToLF(char* str, int size); WINPR_API int ConvertLineEndingToLF(char* str, int size);
WINPR_API char* ConvertLineEndingToCRLF(const char* str, int* size); WINPR_API char* ConvertLineEndingToCRLF(const char* str, int* size);
WINPR_API char* StrSep(char** stringp, const char* delim);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -463,3 +463,22 @@ char* ConvertLineEndingToCRLF(const char* str, int* size)
return newStr; return newStr;
} }
char* StrSep(char** stringp, const char* delim)
{
char* start = *stringp;
char* p;
p = (start != NULL) ? strpbrk(start, delim) : NULL;
if (!p)
*stringp = NULL;
else
{
*p = '\0';
*stringp = p + 1;
}
return start;
}