for (i = 0; backends[i].backend != NULL; i++)
for (i = 0; backends[i].name != NULL; i++)
static void load_settings (char *section, int do_host) {    int i;    HKEY subkey1, sesskey;    char *p;    char prot[10];    p = malloc(3*strlen(section)+1);    mungestr(section, p);    if (RegOpenKey(HKEY_CURRENT_USER, puttystr, &subkey1) != ERROR_SUCCESS) {	sesskey = NULL;    } else {	if (RegOpenKey(subkey1, p, &sesskey) != ERROR_SUCCESS) {	    sesskey = NULL;	}	RegCloseKey(subkey1);    }    free(p);    gpps (sesskey, "HostName", "", cfg.host, sizeof(cfg.host));    gppi (sesskey, "PortNumber", default_port, &cfg.port);    gpps (sesskey, "Protocol", "default", prot, 10);    cfg.protocol = default_protocol;    for (i = 0; backends[i].backend != NULL; i++)        if (!strcmp(prot, backends[i].name)) {            cfg.protocol = backends[i].protocol;            break;        }    gppi (sesskey, "CloseOnExit", 1, &cfg.close_on_exit);    gppi (sesskey, "WarnOnClose", 1, &cfg.warn_on_close);    gpps (sesskey, "TerminalType", "xterm", cfg.termtype,	  sizeof(cfg.termtype));    gpps (sesskey, "TerminalSpeed", "38400,38400", cfg.termspeed,	  sizeof(cfg.termspeed));    {      char buf[2*sizeof(cfg.environmt)], *p, *q;	gpps (sesskey, "Environment", "", buf, sizeof(buf));	p = buf;	q = cfg.environmt;	while (*p) {	    while (*p && *p != ',') {		int c = *p++;		if (c == '=')		    c = '\t';		if (c == '\\')		    c = *p++;		*q++ = c;	    }	    if (*p == ',') p++;	    *q++ = '\0';	}	*q = '\0';    }    gpps (sesskey, "UserName", "", cfg.username, sizeof(cfg.username));    gppi (sesskey, "NoPTY", 0, &cfg.nopty);    {	char cipher[10];	gpps (sesskey, "Cipher", "3des", cipher, 10);	if (!strcmp(cipher, "blowfish"))	    cfg.cipher = CIPHER_BLOWFISH;	else if (!strcmp(cipher, "des"))	    cfg.cipher = CIPHER_DES;	else	    cfg.cipher = CIPHER_3DES;    }    gppi (sesskey, "AuthTIS", 0, &cfg.try_tis_auth);    gppi (sesskey, "RFCEnviron", 0, &cfg.rfc_environ);    gppi (sesskey, "BackspaceIsDelete", 1, &cfg.bksp_is_delete);    gppi (sesskey, "RXVTHomeEnd", 0, &cfg.rxvt_homeend);    gppi (sesskey, "LinuxFunctionKeys", 0, &cfg.linux_funkeys);    gppi (sesskey, "ApplicationCursorKeys", 0, &cfg.app_cursor);    gppi (sesskey, "ApplicationKeypad", 0, &cfg.app_keypad);    gppi (sesskey, "NetHackKeypad", 0, &cfg.nethack_keypad);    gppi (sesskey, "AltF4", 1, &cfg.alt_f4);    gppi (sesskey, "AltSpace", 0, &cfg.alt_space);    gppi (sesskey, "LdiscTerm", 0, &cfg.ldisc_term);    gppi (sesskey, "BlinkCur", 0, &cfg.blink_cur);    gppi (sesskey, "ScrollbackLines", 200, &cfg.savelines);    gppi (sesskey, "DECOriginMode", 0, &cfg.dec_om);    gppi (sesskey, "AutoWrapMode", 1, &cfg.wrap_mode);    gppi (sesskey, "LFImpliesCR", 0, &cfg.lfhascr);    gppi (sesskey, "WinNameAlways", 0, &cfg.win_name_always);    gppi (sesskey, "TermWidth", 80, &cfg.width);    gppi (sesskey, "TermHeight", 24, &cfg.height);    gpps (sesskey, "Font", "Courier", cfg.font, sizeof(cfg.font));    gppi (sesskey, "FontIsBold", 0, &cfg.fontisbold);    gppi (sesskey, "FontCharSet", ANSI_CHARSET, &cfg.fontcharset);    gppi (sesskey, "FontHeight", 10, &cfg.fontheight);    gppi (sesskey, "FontVTMode", VT_OEMANSI, (int *)&cfg.vtmode);    gppi (sesskey, "TryPalette", 0, &cfg.try_palette);    gppi (sesskey, "BoldAsColour", 1, &cfg.bold_colour);    for (i=0; i<22; i++) {	static char *defaults[] = {	    "187,187,187", "255,255,255", "0,0,0", "85,85,85", "0,0,0",	    "0,255,0", "0,0,0", "85,85,85", "187,0,0", "255,85,85",	    "0,187,0", "85,255,85", "187,187,0", "255,255,85", "0,0,187",	    "85,85,255", "187,0,187", "255,85,255", "0,187,187",	    "85,255,255", "187,187,187", "255,255,255" 	};	char buf[20], buf2[30];	int c0, c1, c2;	sprintf(buf, "Colour%d", i);	gpps (sesskey, buf, defaults[i], buf2, sizeof(buf2));	if(sscanf(buf2, "%d,%d,%d", &c0, &c1, &c2) == 3) {	    cfg.colours[i][0] = c0;	    cfg.colours[i][1] = c1;	    cfg.colours[i][2] = c2;	}    }    gppi (sesskey, "MouseIsXterm", 0, &cfg.mouse_is_xterm);    for (i=0; i<256; i+=32) {	static char *defaults[] = {	    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",	    "0,1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1",	    "1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,2",	    "1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1",	    "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1",	    "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1",	    "2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2",	    "2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2"	};	char buf[20], buf2[256], *p;	int j;	sprintf(buf, "Wordness%d", i);	gpps (sesskey, buf, defaults[i/32], buf2, sizeof(buf2));	p = buf2;	for (j=i; j<i+32; j++) {	    char *q = p;	    while (*p && *p != ',') p++;	    if (*p == ',') *p++ = '\0';	    cfg.wordness[j] = atoi(q);	}    }    gppi (sesskey, "KoiWinXlat", 0, &cfg.xlat_enablekoiwin);    gppi (sesskey, "88592Xlat", 0, &cfg.xlat_88592w1250);    gppi (sesskey, "CapsLockCyr", 0, &cfg.xlat_capslockcyr);    RegCloseKey(sesskey);}