libc: Add very basic strtoul()
As well as returning NULL in getenv() instead of aborting.
This commit is contained in:
parent
bf026d0dea
commit
6d7a8a0d0b
@ -30,6 +30,9 @@ extern "C"
|
|||||||
/* Returns an integer (of type long long) parsed from the string str. */
|
/* Returns an integer (of type long long) parsed from the string str. */
|
||||||
long long atoll(const char* str);
|
long long atoll(const char* str);
|
||||||
|
|
||||||
|
/* Returns an integer (of type unsigned long) parsed from the string str. */
|
||||||
|
unsigned long strtoul(const char* str, const char** endptr, int base);
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
char* getenv(const char*);
|
char* getenv(const char*);
|
||||||
|
|
||||||
|
@ -46,9 +46,16 @@ extern "C"
|
|||||||
return string_to_integer_type<long long>(str);
|
return string_to_integer_type<long long>(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long strtoul(const char* str, const char** endptr, int base)
|
||||||
|
{
|
||||||
|
if (base != 0 && base != 10) NOT_IMPLEMENTED("strtoul with base not in (0,10)");
|
||||||
|
if (endptr) NOT_IMPLEMENTED("strtoul with non-null endptr");
|
||||||
|
return string_to_integer_type<unsigned long>(str);
|
||||||
|
}
|
||||||
|
|
||||||
char* getenv(const char*)
|
char* getenv(const char*)
|
||||||
{
|
{
|
||||||
NOT_IMPLEMENTED("getenv");
|
return NULL; // Not implemented :)
|
||||||
}
|
}
|
||||||
|
|
||||||
__lc_noreturn void _Exit(int status)
|
__lc_noreturn void _Exit(int status)
|
||||||
|
Loading…
Reference in New Issue
Block a user