mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-01 20:13:31 +00:00
0ea2907730
For every call of getservbyname/getservbyport the lookup of /etc/services is done by opening the file and parsing each line one-by-one. This is slow, but the implementation is simple. This change also adds fixes for the gethostbyname function.
17 lines
532 B
C
17 lines
532 B
C
#ifndef COSMOPOLITAN_LIBC_DNS_SERVICESTXT_H_
|
|
#define COSMOPOLITAN_LIBC_DNS_SERVICESTXT_H_
|
|
#include "libc/sock/sock.h"
|
|
#include "libc/stdio/stdio.h"
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
int LookupServicesByPort(const int, char **, char *, size_t)
|
|
paramsnonnull((2, 3));
|
|
int LookupServicesByName(const char *, char **) paramsnonnull((1, 2));
|
|
|
|
/* TODO: implement like struct HostsTxt? */
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_DNS_SERVICESTXT_H_ */
|