Improve getservbyname and getservbyport (#207)

- support aliases in /etc/services
- use case insensitive comparisons
- add tests
This commit is contained in:
Gautham 2021-07-06 00:55:26 +05:30 committed by GitHub
parent 58fb2fb3d3
commit c0bec24fa2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 202 additions and 58 deletions

View file

@ -6,9 +6,10 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int LookupServicesByPort(const int, char **, char *, size_t)
int LookupServicesByPort(const int, char **, char *, size_t, const char *)
paramsnonnull((2, 3));
int LookupServicesByName(const char *, char **) paramsnonnull((1, 2));
int LookupServicesByName(const char *, char **, char *, size_t, const char *)
paramsnonnull((1, 2, 3));
/* TODO: implement like struct HostsTxt? */