mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:47:36 +00:00
More random compat hacking towards getting bash to build.
I'm now at the build stage where it complains about a bajillion missing symbols. This is a good place to be!
This commit is contained in:
parent
e76312ab63
commit
82f84bab11
15 changed files with 306 additions and 8 deletions
|
@ -4,6 +4,16 @@
|
|||
|
||||
extern "C" {
|
||||
|
||||
void bzero(void* dest, size_t n)
|
||||
{
|
||||
memset(dest, 0, n);
|
||||
}
|
||||
|
||||
void bcopy(const void* src, void* dest, size_t n)
|
||||
{
|
||||
memmove(dest, src, n);
|
||||
}
|
||||
|
||||
void* memset(void* dest, int c, size_t n)
|
||||
{
|
||||
uint8_t* bdest = (uint8_t*)dest;
|
||||
|
@ -48,11 +58,23 @@ size_t strlen(const char* str)
|
|||
|
||||
int strcmp(const char* s1, const char* s2)
|
||||
{
|
||||
for (; *s1 == *s2; ++s1, ++s2) {
|
||||
if (*s1 == 0)
|
||||
while (*s1 == *s2++)
|
||||
if (*s1++ == 0)
|
||||
return 0;
|
||||
}
|
||||
return *(const unsigned char*)s1 < *(const unsigned char*)s2 ? -1 : 1;
|
||||
return *(const unsigned char*)s1 - *(const unsigned char*)--s2;
|
||||
}
|
||||
|
||||
int strncmp(const char* s1, const char* s2, size_t n)
|
||||
{
|
||||
if (!n)
|
||||
return 0;
|
||||
do {
|
||||
if (*s1 != *s2++)
|
||||
return *(const unsigned char*)s1 - *(const unsigned char*)--s2;
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
} while (--n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int memcmp(const void* v1, const void* v2, size_t n)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue