#define _GNU_SOURCE #include #include #include #include #include #include #ifndef __UTILS_H #define __UTILS_H #define match(a, b) (!strcmp(a, b)) #define matchn(a, b, n) (!strncmp(a, b, n)) int host_to_inet(const char *host, struct in_addr *in); int systemf(const char *fmt, ...); ssize_t safe_read(int fd, void *buf, size_t count); ssize_t safe_readn(int fd, void *buf, size_t len); ssize_t safe_write(int fd, const void *buf, size_t count); ssize_t full_write(int fd, const void *buf, size_t len); int set_nonblocking(int fd); int udp_cork(int fd, int corked); int tcp_cork(int fd, int corked); int inet_conn_str(const char *host, int port, int type); int inet_conn_ia(struct in_addr *host, int port, int type); #endif /* ~__UTILS_H */