mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 09:48:29 +00:00
Add Musl multibyte functions
These are standard functions that are needed to help support the Skull language. Note that normally this codebase uses libc/str/thompike.h See #105
This commit is contained in:
parent
cfd453d125
commit
11ec99931b
28 changed files with 1064 additions and 131 deletions
|
@ -28,6 +28,15 @@
|
|||
* @see memmem()
|
||||
*/
|
||||
wchar_t *wcsstr(const wchar_t *haystack, const wchar_t *needle) {
|
||||
return memmem(haystack, wcslen(haystack) * sizeof(wchar_t), needle,
|
||||
wcslen(needle) * sizeof(wchar_t));
|
||||
size_t i;
|
||||
for (;;) {
|
||||
for (i = 0;;) {
|
||||
if (!needle[i]) return (/*unconst*/ wchar_t *)haystack;
|
||||
if (!haystack[i]) break;
|
||||
if (needle[i] != haystack[i]) break;
|
||||
++i;
|
||||
}
|
||||
if (!*haystack++) break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue