forked from Bananymous/banan-os
65 lines
759 B
C++
65 lines
759 B
C++
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
#include <ctype.h>
|
||
|
|
||
|
void abort(void)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
int abs(int val)
|
||
|
{
|
||
|
return val < 0 ? -val : val;
|
||
|
}
|
||
|
|
||
|
int atexit(void(*)(void))
|
||
|
{
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
int atoi(const char* str)
|
||
|
{
|
||
|
while (isspace(*str))
|
||
|
str++;
|
||
|
|
||
|
bool negative = (*str == '-');
|
||
|
|
||
|
if (*str == '-' || *str == '+')
|
||
|
str++;
|
||
|
|
||
|
int res = 0;
|
||
|
while (isdigit(*str))
|
||
|
{
|
||
|
res = (res * 10) + (*str - '0');
|
||
|
str++;
|
||
|
}
|
||
|
|
||
|
return negative ? -res : res;
|
||
|
}
|
||
|
|
||
|
char* getenv(const char*)
|
||
|
{
|
||
|
return nullptr;
|
||
|
}
|
||
|
|
||
|
void* malloc(size_t)
|
||
|
{
|
||
|
return nullptr;
|
||
|
}
|
||
|
|
||
|
void* calloc(size_t nmemb, size_t size)
|
||
|
{
|
||
|
if (nmemb * size < nmemb)
|
||
|
return nullptr;
|
||
|
void* ptr = malloc(nmemb * size);
|
||
|
if (ptr == nullptr)
|
||
|
return nullptr;
|
||
|
memset(ptr, 0, nmemb * size);
|
||
|
return ptr;
|
||
|
}
|
||
|
|
||
|
void free(void*)
|
||
|
{
|
||
|
|
||
|
}
|