summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorJames Maki <jmaki@multitech.com>2010-04-23 12:32:53 -0500
committerJames Maki <jmaki@multitech.com>2010-04-23 12:32:53 -0500
commit5450acde53db80f453a658f59ab887212680ca34 (patch)
treec67ba88c2d9e5a4fcf84919ea607214618614bd5 /src/utils.h
downloadvenus-gps-5450acde53db80f453a658f59ab887212680ca34.tar.gz
venus-gps-5450acde53db80f453a658f59ab887212680ca34.tar.bz2
venus-gps-5450acde53db80f453a658f59ab887212680ca34.zip
initial commit
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
new file mode 100644
index 0000000..71d3e9c
--- /dev/null
+++ b/src/utils.h
@@ -0,0 +1,27 @@
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <errno.h>
+#include <arpa/inet.h>
+
+#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 inet_conn_str(char *host, int port, int type);
+int inet_conn_ia(struct in_addr *host, int port, int type);
+
+#endif /* ~__UTILS_H */