summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNick White <hg@njw.me.uk>2011-07-15 22:40:48 +0100
committerNick White <hg@njw.me.uk>2011-07-15 22:40:48 +0100
commit14f2069f02e86c54209e03f284aebd81ce8b85e4 (patch)
treeb235657b4195e8e2570d5cea7b4295f25534170e /util.c
parent2061b653da64bcb90c217144686f74ee734fb90c (diff)
Move everything back to getgbook.c
Diffstat (limited to 'util.c')
-rw-r--r--util.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/util.c b/util.c
deleted file mode 100644
index d9afa59..0000000
--- a/util.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* See LICENSE file for license details. */
-#include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-void die(char *msg) {
- fputs(msg, stderr);
- exit(EXIT_FAILURE);
-}
-
-/* plundered from suckless' sic */
-static int
-dial(char *host, char *port) {
- static struct addrinfo hints;
- int srv;
- struct addrinfo *res, *r;
-
- memset(&hints, 0, sizeof hints);
- hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_STREAM;
- if(getaddrinfo(host, port, &hints, &res) != 0)
- die("error: cannot resolve hostname\n");
- for(r = res; r; r = r->ai_next) {
- if((srv = socket(r->ai_family, r->ai_socktype, r->ai_protocol)) == -1)
- continue;
- if(connect(srv, r->ai_addr, r->ai_addrlen) == 0)
- break;
- close(srv);
- }
- freeaddrinfo(res);
- if(!r)
- die("error: cannot connect to host\n");
- return srv;
-}