From ee5816b9c8d1da8f0e01eaaddb6e73150dfa827f Mon Sep 17 00:00:00 2001 From: Read H Date: Thu, 16 Apr 2020 13:37:06 -0400 Subject: LibC: getprotoent() family of functions This commit implements the getprotoent() family of functions, including getprotoent() getprotobyname() getprotobynumber() setprotoent() endprotoent() This implementation is very similar to the getservent family of functions, which is what led to the discovery of a bug in the process of reading the aliases. The ByteBuffer for the alias strings didn't include a null terminating character, this was fixed for both the protoent and servent family of functions by appending a null character to the end of them before adding them to the alias lists. --- Libraries/LibC/netdb.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Libraries/LibC/netdb.h') diff --git a/Libraries/LibC/netdb.h b/Libraries/LibC/netdb.h index 802c89a39d..c2bd5a130f 100644 --- a/Libraries/LibC/netdb.h +++ b/Libraries/LibC/netdb.h @@ -55,6 +55,19 @@ struct servent* getservbyname(const char* name, const char* protocol); struct servent* getservbyport(int port, const char* protocol); void setservent(int stay_open); void endservent(); + +struct protoent { + char* p_name; + char** p_aliases; + int p_proto; +}; + +void endprotoent(); +struct protoent* getprotobyname(const char* name); +struct protoent* getprotobynumber(int proto); +struct protoent* getprotoent(); +void setprotoent(int stay_open); + extern int h_errno; #define HOST_NOT_FOUND 101 -- cgit v1.2.3