}
function psi\gethostent() : array {
- return to_array(gethostent,
+ return to_array(*gethostent,
to_string(h_name),
to_array(h_aliases, to_string(h_aliases)),
to_int(h_addrtype),
}
// extern int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
-function psi\getaddrinfo(string $node, string $service, array $hints, object &$res = NULL) : int {
+function psi\getaddrinfo(string $node, string $service, array $hints = NULL, object &$res = NULL) : int {
let node = strval($node);
let service = strval($service);
- let hints = arrval($hints);
+ let hints = &arrval($hints,
+ intval($ai_flags),
+ intval($ai_family),
+ intval($ai_socktype),
+ intval($ai_protocol)
+ );
let res = &NULL;
return to_int(getaddrinfo);
set $res = to_array(**res,
to_string(ai_canonname),
to_array(*ai_next, ...)
);
- free freeaddrinfo(res);
+ free freeaddrinfo(*res);
}
// extern int getnameinfo(struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)