unsigned int irc_connect(unsigned char *servaddr, int servport) {
unsigned int irc_connect(unsigned char *servaddr, unsigned int servport) {
unsigned int irc_connect(unsigned char *servaddr, int servport) {    struct sockaddr_in addr;    struct hostent *hosttoip;    #ifdef PLATFORM_WINDOWS    WSADATA wsa;    #endif        if(eventloop_running) {        make_error("Attempt to connect while the event loop is still running -- halted.");        return CERROR_EVENTLOOPFAIL;    }        #ifdef PLATFORM_WINDOWS    if(WSAStartup(0x0202, &wsa)) {        WSACleanup();        return CERROR_STARTFAIL;    }        if(wsa.wVersion != 0x0202) {        WSACleanup();        return CERROR_WSOLD;    }    #endif        if(!(hosttoip = gethostbyname(servaddr))) {        #ifdef PLATFORM_WINDOWS        WSACleanup();        #endif        return CERROR_HOSTTOIPFAIL;    }        if((bot.sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {        #ifdef PLATFORM_WINDOWS        WSACleanup();        #endif        return CERROR_SOCKFAIL;    }        addr.sin_family = AF_INET;    addr.sin_port = htons(bot.servport);    addr.sin_addr = *((struct in_addr*) hosttoip->h_addr);        if(connect(bot.sock, (struct sockaddr*) &addr, sizeof(struct sockaddr)) == -1) {        #ifdef PLATFORM_WINDOWS        WSACleanup();        #endif        return CERROR_CONFAIL;    }        if(mkthread(irc_sockeventloop, NULL) == 0) {        getchar();        return CERROR_EVENTLOOPFAIL;    }        return CERROR_SUCCESS;}