if( cfg.ldisc_term ) { struct Opt **o;  for (o = opts; *o; o++) if ((*o)->state == REQUESTED) (*o)->state = INACTIVE; } else
static char *telnet_init (HWND hwnd, char *host, int port, char **realhost) {    SOCKADDR_IN addr;    struct hostent *h;    unsigned long a;    /*     * Try to find host.     */    if ( (a = inet_addr(host)) == (unsigned long) INADDR_NONE) {	if ( (h = gethostbyname(host)) == NULL)	    switch (WSAGetLastError()) {	      case WSAENETDOWN: return "Network is down";	      case WSAHOST_NOT_FOUND: case WSANO_DATA:		return "Host does not exist";	      case WSATRY_AGAIN: return "Host not found";	      default: return "gethostbyname: unknown error";	    }	memcpy (&a, h->h_addr, sizeof(a));	*realhost = h->h_name;    } else	*realhost = host;    a = ntohl(a);    if (port < 0)	port = 23;		       /* default telnet port */    /*     * Open socket.     */    s = socket(AF_INET, SOCK_STREAM, 0);    if (s == INVALID_SOCKET)	switch (WSAGetLastError()) {	  case WSAENETDOWN: return "Network is down";	  case WSAEAFNOSUPPORT: return "TCP/IP support not present";	  default: return "socket(): unknown error";	}#if 0    {	BOOL b = TRUE;	setsockopt (s, SOL_SOCKET, SO_OOBINLINE, (void *)&b, sizeof(b));    }#endif    /*     * Bind to local address.     */    addr.sin_family = AF_INET;    addr.sin_addr.s_addr = htonl(INADDR_ANY);    addr.sin_port = htons(0);    if (bind (s, (struct sockaddr *)&addr, sizeof(addr)) == SOCKET_ERROR)	switch (WSAGetLastError()) {	  case WSAENETDOWN: return "Network is down";	  default: return "bind(): unknown error";	}    /*     * Connect to remote address.     */    addr.sin_addr.s_addr = htonl(a);    addr.sin_port = htons((short)port);    if (connect (s, (struct sockaddr *)&addr, sizeof(addr)) == SOCKET_ERROR)	switch (WSAGetLastError()) {	  case WSAENETDOWN: return "Network is down";	  case WSAECONNREFUSED: return "Connection refused";	  case WSAENETUNREACH: return "Network is unreachable";	  case WSAEHOSTUNREACH: return "No route to host";	  default: return "connect(): unknown error";	}    if (WSAAsyncSelect (s, hwnd, WM_NETEVENT, FD_READ |			FD_WRITE | FD_OOB | FD_CLOSE) == SOCKET_ERROR)	switch (WSAGetLastError()) {	  case WSAENETDOWN: return "Network is down";	  default: return "WSAAsyncSelect(): unknown error";	}    /*     * Initialise option states.     */    {	struct Opt **o;	for (o = opts; *o; o++)	    if ((*o)->state == REQUESTED)		send_opt ((*o)->send, (*o)->option);    }#if 0    /*     * Set up SYNCH state.     */    in_synch = FALSE;#endif    return NULL;}