ctk_window_close(&window); ctk_window_close(&setupwindow);
EK_EVENTHANDLER(eventhandler, ev, data){  ctk_arch_key_t c;  u16_t *ipaddr;    if(ev == EK_EVENT_INIT) {    ctk_textedit_init(&lineedit);    memset(line, 0, sizeof(line));    memset(log, 0, sizeof(log));    ctk_window_new(&window, LOG_WIDTH, LOG_HEIGHT + 1, "IRC");    CTK_WIDGET_ADD(&window, &loglabel);    ctk_textedit_add(&window, &lineedit);        ctk_window_new(&setupwindow, SETUPWINDOW_WIDTH, SETUPWINDOW_HEIGHT,		   "IRC setup");    CTK_WIDGET_ADD(&setupwindow, &serverlabel);    CTK_WIDGET_ADD(&setupwindow, &serverentry);    CTK_WIDGET_ADD(&setupwindow, &nicklabel);    CTK_WIDGET_ADD(&setupwindow, &nickentry);    CTK_WIDGET_ADD(&setupwindow, &quitbutton);    CTK_WIDGET_ADD(&setupwindow, &connectbutton);    ctk_window_open(&setupwindow);  } else if(ev == EK_EVENT_REQUEST_EXIT ||	    ev == ctk_signal_window_close) {    quit();  } else if(ev == tcpip_event) {    ircc_appcall(data);  } else if(ev == ctk_signal_widget_activate) {    if(data == (ek_data_t)&lineedit) {      parse_line();    } else if(data == (ek_data_t)&quitbutton) {      ctk_window_close(&window);      ctk_window_close(&setupwindow);      quit();    } else if(data == (ek_data_t)&connectbutton) {      ctk_window_close(&setupwindow);      ctk_window_open(&window);      ipaddr = serveraddr;      if(uiplib_ipaddrconv(server, serveraddr) == 0) {	ipaddr = resolv_lookup(server);	if(ipaddr == NULL) {	  resolv_query(server);	} else {	  uip_ipaddr_copy(serveraddr, ipaddr);	}      }      if(ipaddr != NULL) {	       	ircc_connect(&s, server, serveraddr, nick);      }    }  } else if(ev == resolv_event_found) {    ipaddr = resolv_lookup(server);    if(ipaddr == NULL) {      ircc_text_output(&s, server, "hostname not found");    } else {      uip_ipaddr_copy(serveraddr, ipaddr);      ircc_connect(&s, server, serveraddr, nick);    }	         } else if(ev == ctk_signal_keypress) {    c = (ctk_arch_key_t)data;    if(c == CH_ENTER) {      parse_line();    } else {      ctk_textedit_eventhandler(&lineedit, ev, data);    }  }}