char *errmsg;
const char *errmsg;
void mac_startsession(Session *s){    char *errmsg;    int i;    WinInfo *wi;    init_ucs(s);    /*     * Select protocol. This is farmed out into a table in a     * separate file to enable an ssh-free variant.     */    s->back = NULL;    for (i = 0; backends[i].backend != NULL; i++)	if (backends[i].protocol == s->cfg.protocol) {	    s->back = backends[i].backend;	    break;	}    if (s->back == NULL)	fatalbox("Unsupported protocol number found");    /* XXX: Own storage management? */    if (HAVE_COLOR_QD())	s->window = GetNewCWindow(wTerminal, NULL, (WindowPtr)-1);    else	s->window = GetNewWindow(wTerminal, NULL, (WindowPtr)-1);    wi = snew(WinInfo);    memset(wi, 0, sizeof(*wi));    wi->s = s;    wi->wtype = wTerminal;    wi->activate = &mac_activateterm;    wi->adjustcursor = &mac_adjusttermcursor;    wi->adjustmenus = &mac_adjusttermmenus;    wi->update = &mac_updateterm;    wi->click = &mac_clickterm;    wi->grow = &mac_growterm;    wi->key = &mac_keyterm;    wi->menu = &mac_menuterm;    wi->close = &mac_closeterm;    SetWRefCon(s->window, (long)wi);    s->scrollbar = GetNewControl(cVScroll, s->window);    s->term = term_init(&s->cfg, &s->ucsdata, s);    mac_initfont(s);    mac_initpalette(s);    if (HAVE_COLOR_QD()) {	/* Set to FALSE to not get palette updates in the background. */	SetPalette(s->window, s->palette, TRUE); 	ActivatePalette(s->window);    }    s->logctx = log_init(s->term, &s->cfg);    term_provide_logctx(s->term, s->logctx);    errmsg = s->back->init(s, &s->backhandle, &s->cfg, s->cfg.host,			   s->cfg.port, &s->realhost, s->cfg.tcp_nodelay);    if (errmsg != NULL)	fatalbox("%s", errmsg);    s->back->provide_logctx(s->backhandle, s->logctx);    set_title(s, s->realhost);    term_provide_resize_fn(s->term, s->back->size, s->backhandle);    mac_adjustsize(s, s->cfg.height, s->cfg.width);    term_size(s->term, s->cfg.height, s->cfg.width, s->cfg.savelines);    s->ldisc = ldisc_create(&s->cfg, s->term, s->back, s->backhandle, s);    ldisc_send(s->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */    ShowWindow(s->window);    s->next = sesslist;    s->prev = &sesslist;    if (s->next != NULL)	s->next->prev = &s->next;    sesslist = s;}