LibC: Add inet_pton for IPv4 addresses

This commit is contained in:
Bananymous 2025-10-02 16:19:49 +03:00
parent c89780178f
commit 73fb085a41
1 changed files with 9 additions and 0 deletions

View File

@ -95,3 +95,12 @@ const char* inet_ntop(int af, const void* __restrict src, char* __restrict dst,
errno = EAFNOSUPPORT; errno = EAFNOSUPPORT;
return nullptr; return nullptr;
} }
int inet_pton(int af, const char* __restrict src, void* __restrict dst)
{
if (af == AF_INET)
return inet_aton(src, static_cast<in_addr*>(dst));
errno = EAFNOSUPPORT;
return -1;
}