diff --git a/libs/libc/include/stdlib.h b/libs/libc/include/stdlib.h index 647a9b04..1909b7e6 100644 --- a/libs/libc/include/stdlib.h +++ b/libs/libc/include/stdlib.h @@ -30,6 +30,9 @@ extern "C" /* Returns an integer (of type long long) parsed from the string 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. */ char* getenv(const char*); diff --git a/libs/libc/src/stdlib.cpp b/libs/libc/src/stdlib.cpp index 283d3154..36d7e0e7 100644 --- a/libs/libc/src/stdlib.cpp +++ b/libs/libc/src/stdlib.cpp @@ -46,9 +46,16 @@ extern "C" return string_to_integer_type(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(str); + } + char* getenv(const char*) { - NOT_IMPLEMENTED("getenv"); + return NULL; // Not implemented :) } __lc_noreturn void _Exit(int status)