mirror of
https://github.com/gligli/nulldc-360.git
synced 2025-04-02 11:11:56 -04:00
41 lines
No EOL
658 B
C
41 lines
No EOL
658 B
C
#include <stdlib.h>
|
|
#include <wchar.h>
|
|
|
|
size_t
|
|
wcslen(const wchar_t *s) {
|
|
const wchar_t *p;
|
|
|
|
p = s;
|
|
while (*p)
|
|
p++;
|
|
|
|
return p - s;
|
|
}
|
|
|
|
wchar_t *
|
|
wcsdup(const wchar_t *str) {
|
|
wchar_t *copy;
|
|
size_t len;
|
|
|
|
len = wcslen(str) + 1;
|
|
copy = malloc(len * sizeof (wchar_t));
|
|
|
|
if (!copy)
|
|
return (NULL);
|
|
|
|
return (wmemcpy(copy, str, len));
|
|
}
|
|
|
|
wchar_t *
|
|
wcscpy(wchar_t *s1, const wchar_t *s2) {
|
|
wchar_t *p;
|
|
const wchar_t *q;
|
|
|
|
p = s1;
|
|
q = s2;
|
|
while (*q)
|
|
*p++ = *q++;
|
|
*p = '\0';
|
|
|
|
return s1;
|
|
} |