diff options
Diffstat (limited to 'games/xtris/patches/patch-ac')
-rw-r--r-- | games/xtris/patches/patch-ac | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/games/xtris/patches/patch-ac b/games/xtris/patches/patch-ac new file mode 100644 index 00000000000..4a1e116ee82 --- /dev/null +++ b/games/xtris/patches/patch-ac @@ -0,0 +1,59 @@ +$NetBSD: patch-ac,v 1.1.1.1 2002/01/25 17:47:19 hubertf Exp $ + +--- xtbot.c.orig Wed Apr 9 20:01:58 1997 ++++ xtbot.c +@@ -614,11 +614,46 @@ + } + + static void connect2server(char *h) { ++#ifdef INET6 ++ struct addrinfo hints, *res0, *res; ++ struct sockaddr_storage s; ++ char serv_buf[NI_MAXSERV]; ++ char str_buf[512]; ++ int gai; ++#else + struct hostent *hp; + struct sockaddr_in s; ++#endif + struct protoent *tcpproto; + int on = 1; + ++#ifdef INET6 ++ snprintf(serv_buf, sizeof(serv_buf) , "%d", port); ++ serv_buf[sizeof(serv_buf)-1] = '\0'; ++ memset (&hints, 0, sizeof(hints)); ++ hints.ai_family = PF_UNSPEC; ++ hints.ai_socktype = SOCK_STREAM; ++ gai = getaddrinfo(h, serv_buf, &hints, &res0); ++ if (gai){ ++ snprintf(str_buf, sizeof(str_buf)-1, ++ "getaddrinfo(): %s", gai_strerror(gai)); ++ fatal(str_buf); ++ } ++ for (res=res0; res; res=res->ai_next){ ++ sfd = socket(res->ai_family, res->ai_socktype, 0); ++ if (sfd < 0) continue; ++ if ((tcpproto = getprotobyname("tcp")) != NULL) ++ setsockopt(sfd, tcpproto->p_proto, TCP_NODELAY, (char *)&on, sizeof(int)); ++ if (connect(sfd, res->ai_addr, res->ai_addrlen) < 0){ ++ close(sfd); ++ sfd = -1; ++ continue; ++ } ++ break; ++ } ++ if (sfd < 0) ++ fatal("Can't connect to server"); ++#else + if (h) { + if ((s.sin_addr.s_addr = inet_addr(h)) == -1) { + hp = gethostbyname(h); +@@ -637,6 +672,7 @@ + + if (connect(sfd, (struct sockaddr *)&s, sizeof(s)) < 0) + fatal("Can't connect to server"); ++#endif + + buf[1] = OP_NICK; + memcpy(&buf[2], mynick, strlen(mynick)); |