X-Git-Url: https://git.cworth.org/git?p=ttt;a=blobdiff_plain;f=src%2Fx.h;h=64a18a22c2492d5727379258efb059d4e1d3b2e2;hp=52c3acdd6ffe7a79ac1fe3f23f36d628784a7555;hb=95898262b4ce4a2a3d36f70a4e6cc8188decc142;hpb=cce891bb05118330ca609ac989491ad8a2fa7f71 diff --git a/src/x.h b/src/x.h index 52c3acd..64a18a2 100644 --- a/src/x.h +++ b/src/x.h @@ -22,8 +22,10 @@ #ifndef _X_H_ #define _X_H_ +#include "ttt.h" + void -xasprintf (char **strp, const char *fmt, ...) WDO_PRINTF_FORMAT(2, 3); +xasprintf (char **strp, const char *fmt, ...) TTT_PRINTF_FORMAT(2, 3); void xvasprintf (char **strp, const char *fmt, va_list ap); @@ -43,10 +45,47 @@ xcalloc (size_t nmemb, size_t size); void * xrealloc (void *ptr, size_t size); +FILE * +xfopen (const char *path, const char *mode); + FILE * xfdopen (int filedes, const char *mode); +void +xdup2 (int oldfd, int newfd); + char * xstrdup (const char *s); +void +xfwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream); + +int +xsocket (int domain, int type, int protocol); + +void +xbind (int sockfd, const struct sockaddr *my_addr, socklen_t addrlen); + +ttt_status_t +xconnect (int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen); + +void +xlisten (int s, int backlog); + +int +xfcntl (int fd, int cmd, long arg); + +int +xselect (int n, + fd_set *readfds, + fd_set *writefds, + fd_set *exceptfds, + struct timeval *timeout); + +ssize_t +xread (int fd, void *buf, size_t count); + +ssize_t +xwrite (int fd, const void *buf, size_t count); + #endif /* _X_H_ */