wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 0115b00394aa7a7c97a008e1431c58c3b116ffc1
parent b04617dae9f5a101ebd67f22a042ab96720c05a5
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Mon, 29 May 2006 09:43:30 +0200

applied John-Galt's patch of libixp/socket.c


Diffstat:
TODO.wmii-4 | 1+
libixp/socket.c | 11++++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/TODO.wmii-4 b/TODO.wmii-4 @@ -1,3 +1,4 @@ +- remove snap-to-border for managed windows (is pointless). - UTF8 fixes with iconv? - re-introduce mouse based resizals (titlebar and border) - idea for column mode: diff --git a/libixp/socket.c b/libixp/socket.c @@ -107,6 +107,7 @@ create_inet_sock(char *host, char **errstr) { int fd; struct sockaddr_in addr = { 0 }; + struct hostent *hp; char *port = strrchr(host, '!'); unsigned int prt; @@ -125,9 +126,17 @@ create_inet_sock(char *host, char **errstr) return -1; } addr.sin_family = AF_INET; - addr.sin_addr.s_addr = htonl(INADDR_ANY); addr.sin_port = htons(prt); + if(!strncmp(host, "*", 1)) + addr.sin_addr.s_addr = htonl(INADDR_ANY); + else if((hp = gethostbyname(host))) + bcopy(hp->h_addr, &addr.sin_addr, hp->h_length); + else { + *errstr = "cannot translate hostname to an address"; + return -1; + } + if(bind(fd, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) < 0) { *errstr = "cannot bind socket"; close(fd);