On Mon, May 19, 2008 at 1:58 PM, Anselm R. Garbe <[EMAIL PROTECTED]> wrote: > Hi Sylvain, > > any chance to let us agree on the MIT license for the IPv6 bits?
Ok, make it all MIT ( 10 lines... :) ), but you should really consider GPLv3 instead of MIT, just because we don't live in a perfect world... really... Kind regards, Sylvain > > Kind regards, > Anselm > > On Mon, May 19, 2008 at 01:51:18PM +0200, Sylvain Bertrand wrote: >> diff -u sic-0.9/LICENSE sic-0.9-ipv6/LICENSE >> --- sic-0.9/LICENSE 2007-02-13 17:02:16.000000000 +0100 >> +++ sic-0.9-ipv6/LICENSE 2008-05-19 13:32:09.000000000 +0200 >> @@ -1,6 +1,6 @@ >> MIT/X Consortium License >> >> -(C)opyright MMV-MMVI Anselm R. Garbe <[EMAIL PROTECTED]> >> +(C)opyright MMV-MMVIII Anselm R. Garbe <[EMAIL PROTECTED]> >> (C)opyright MMV Nico Golde <nico at ngolde dot de> >> >> Permission is hereby granted, free of charge, to any person obtaining a >> @@ -20,3 +20,8 @@ >> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING >> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER >> DEALINGS IN THE SOFTWARE. >> + >> +-------------------------------------------------------------------------------- >> + >> +IPv6 code is protected by the GPLv3 >> +(C)opyright MMVIII Sylvain BERTRAND <sylvain.bertrand at gmail dot com> >> diff -u sic-0.9/sic.c sic-0.9-ipv6/sic.c >> --- sic-0.9/sic.c 2008-03-20 12:26:29.000000000 +0100 >> +++ sic-0.9-ipv6/sic.c 2008-05-19 13:34:16.000000000 +0200 >> @@ -1,5 +1,6 @@ >> /* (C)opyright MMV-MMVI Anselm R. Garbe <garbeam at gmail dot com> >> * (C)opyright MMV-MMVI Nico Golde <nico at ngolde dot de> >> + * (C)opyright MMVIII Sylvain BERTRAND <sylvain.bertrand at gmail dot com> >> * See LICENSE file for license details. >> */ >> #include <errno.h> >> @@ -17,8 +18,8 @@ >> #define PINGTIMEOUT 1000 >> #define MAXMSG 4096 >> >> -static char *host = "irc.freenode.net"; >> -static unsigned short port = 6667; >> +static char *host = "ipv6.chat.eu.freenode.net"; >> +static char *port = "6667"; >> static char *password = NULL; >> static char nick[32]; >> >> @@ -154,10 +155,9 @@ >> main(int argc, char *argv[]) { >> int i; >> struct timeval tv; >> - struct hostent *hp; >> - static struct sockaddr_in addr; /* initially filled with 0's */ >> char ping[256]; >> fd_set rd; >> + struct addrinfo hints,*results,*rp; >> >> strncpy(nick, getenv("USER"), sizeof nick); >> for(i = 1; i < argc; i++) >> @@ -165,7 +165,7 @@ >> if(++i < argc) host = argv[i]; >> } >> else if(!strncmp(argv[i], "-p", 3)) { >> - if(++i < argc) port = (unsigned short)atoi(argv[i]); >> + if(++i < argc) port = argv[i]; >> } >> else if(!strncmp(argv[i], "-n", 3)) { >> if(++i < argc) strncpy(nick, argv[i], sizeof nick); >> @@ -174,22 +174,24 @@ >> if(++i < argc) password = argv[i]; >> } >> else if(!strncmp(argv[i], "-v", 3)) >> - eprint("sic-"VERSION", (C)opyright MMVI Anselm >> R. Garbe\n"); >> + eprint("sic-"VERSION", (C)opyright MMV-MMVIII >> Anselm R. Garbe and others\n"); >> else >> eprint("usage: sic [-h host] [-p port] [-n >> nick] [-k keyword] [-v]\n"); >> >> /* init */ >> - if((srv = socket(AF_INET, SOCK_STREAM, 0)) < 0) >> - eprint("sic: cannot connect host '%s'\n", host); >> - if(NULL == (hp = gethostbyname(host))) >> - eprint("sic: cannot resolve hostname '%s'\n", host); >> - addr.sin_family = AF_INET; >> - addr.sin_port = htons(port); >> - memcpy(&addr.sin_addr, hp->h_addr, hp->h_length); >> - if(connect(srv, (struct sockaddr *) &addr, sizeof(struct >> sockaddr_in))) { >> + memset(&hints,0,sizeof(hints)); >> + hints.ai_family=AF_INET6; >> + hints.ai_socktype=SOCK_STREAM; >> + if(getaddrinfo(host,port,&hints,&results)!=0) >> + eprint("sic: cannot resolve hostname '%s'\n",host); >> + for(rp=results;rp!=NULL;rp=rp->ai_next){ >> + >> if((srv=socket(rp->ai_family,rp->ai_socktype,rp->ai_protocol))<0) >> continue; >> + if(connect(srv,rp->ai_addr,rp->ai_addrlen)!=-1) break; >> close(srv); >> - eprint("sic: cannot connect host '%s'\n", host); >> } >> + if(!rp) eprint("sic: unable to connect to '%s:%s'\n",host,port); >> + freeaddrinfo(results); >> + >> /* login */ >> if(password) >> snprintf(bufout, sizeof bufout, >> > > -- > Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361 > > -- use single GPL licensed software, use Linux and secure your digital freedom!