1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

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.
This commit is contained in:
Read H 2020-04-16 13:37:06 -04:00 committed by Andreas Kling
parent 0ef2efac7c
commit ee5816b9c8
2 changed files with 208 additions and 1 deletions

View file

@ -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