diff --git a/luna/include/luna/CString.h b/luna/include/luna/CString.h index d677104a..8b606af7 100644 --- a/luna/include/luna/CString.h +++ b/luna/include/luna/CString.h @@ -8,6 +8,7 @@ extern "C" int memcmp(const void* a, const void* b, usize n); void* memmove(void* dest, const void* src, usize n); usize strlen(const char* str); + int strcmp(const char* a, const char* b); usize wcslen(const wchar_t* str); diff --git a/luna/src/CString.cpp b/luna/src/CString.cpp index 7bb47ee7..83d15661 100644 --- a/luna/src/CString.cpp +++ b/luna/src/CString.cpp @@ -46,6 +46,16 @@ extern "C" return (usize)(i - str); } + int strcmp(const char* a, const char* b) + { + while (*a && (*a == *b)) + { + a++; + b++; + } + return *(const u8*)a - *(const u8*)b; + } + usize wcslen(const wchar_t* str) { const wchar_t* i = str;