if (dbcs_screenfont && font_codepage != line_codepage) {  unitab_line['\\'] = ATTR_OEMCP + '\\'; }
void init_ucs_tables(void){    int i, j;    int used_dtf = 0;    char tbuf[256];    for (i = 0; i < 256; i++)	tbuf[i] = i;    /* Decide on the Line and Font codepages */    line_codepage = decode_codepage(cfg.line_codepage);    if (font_codepage <= 0) { 	font_codepage=0; 	dbcs_screenfont=0;     }    if (cfg.vtmode == VT_OEMONLY) {	font_codepage = 437;	dbcs_screenfont = 0;	if (line_codepage <= 0)	    line_codepage = GetACP();    } else if (line_codepage <= 0)	line_codepage = font_codepage;    /* Collect screen font ucs table */    if (dbcs_screenfont || font_codepage == 0) {	get_unitab(font_codepage, unitab_font, 2);	for (i = 128; i < 256; i++)	    unitab_font[i] = (WCHAR) (ATTR_ACP + i);    } else {	get_unitab(font_codepage, unitab_font, 1);	/* CP437 fonts are often broken ... */	if (font_codepage == 437)	    unitab_font[0] = unitab_font[255] = 0xFFFF;    }    if (cfg.vtmode == VT_XWINDOWS)	memcpy(unitab_font + 1, unitab_xterm_std,	       sizeof(unitab_xterm_std));    /* Collect OEMCP ucs table */    get_unitab(CP_OEMCP, unitab_oemcp, 1);    /* Collect CP437 ucs table for SCO acs */    if (cfg.vtmode == VT_OEMANSI || cfg.vtmode == VT_XWINDOWS)	memcpy(unitab_scoacs, unitab_oemcp, sizeof(unitab_scoacs));    else	get_unitab(437, unitab_scoacs, 1);    /* Collect line set ucs table */    if (line_codepage == font_codepage &&	(dbcs_screenfont || cfg.vtmode == VT_POORMAN || font_codepage==0)) {	/* For DBCS and POOR fonts force direct to font */	used_dtf = 1;	for (i = 0; i < 32; i++)	    unitab_line[i] = (WCHAR) i;	for (i = 32; i < 256; i++)	    unitab_line[i] = (WCHAR) (ATTR_ACP + i);	unitab_line[127] = (WCHAR) 127;    } else {	get_unitab(line_codepage, unitab_line, 0);    }#if 0    debug(	  ("Line cp%d, Font cp%d%s\n", line_codepage, font_codepage,	   dbcs_screenfont ? " DBCS" : ""));    for (i = 0; i < 256; i += 16) {	for (j = 0; j < 16; j++) {	    debug(("%04x%s", unitab_line[i + j], j == 15 ? "" : ","));	}	debug(("\n"));    }#endif    /* VT100 graphics - NB: Broken for non-ascii CP's */    memcpy(unitab_xterm, unitab_line, sizeof(unitab_xterm));    memcpy(unitab_xterm + '`', unitab_xterm_std, sizeof(unitab_xterm_std));    unitab_xterm['_'] = ' ';    /* Generate UCS ->line page table. */    if (uni_tbl) {	for (i = 0; i < 256; i++)	    if (uni_tbl[i])		sfree(uni_tbl[i]);	sfree(uni_tbl);	uni_tbl = 0;    }    if (!used_dtf) {	for (i = 0; i < 256; i++) {	    if (DIRECT_CHAR(unitab_line[i]))		continue;	    if (DIRECT_FONT(unitab_line[i]))		continue;	    if (!uni_tbl) {		uni_tbl = smalloc(256 * sizeof(char *));		memset(uni_tbl, 0, 256 * sizeof(char *));	    }	    j = ((unitab_line[i] >> 8) & 0xFF);	    if (!uni_tbl[j]) {		uni_tbl[j] = smalloc(256 * sizeof(char));		memset(uni_tbl[j], 0, 256 * sizeof(char));	    }	    uni_tbl[j][unitab_line[i] & 0xFF] = i;	}    }    /* Find the line control characters. */    for (i = 0; i < 256; i++)	if (unitab_line[i] < ' '	    || (unitab_line[i] >= 0x7F && unitab_line[i] < 0xA0))	    unitab_ctrl[i] = i;	else	    unitab_ctrl[i] = 0xFF;    /* Generate line->screen direct conversion links. */    if (cfg.vtmode == VT_OEMANSI || cfg.vtmode == VT_XWINDOWS)	link_font(unitab_scoacs, unitab_oemcp, ATTR_OEMCP);    link_font(unitab_line, unitab_font, ATTR_ACP);    link_font(unitab_scoacs, unitab_font, ATTR_ACP);    link_font(unitab_xterm, unitab_font, ATTR_ACP);    if (cfg.vtmode == VT_OEMANSI || cfg.vtmode == VT_XWINDOWS) {	link_font(unitab_line, unitab_oemcp, ATTR_OEMCP);	link_font(unitab_xterm, unitab_oemcp, ATTR_OEMCP);    }    /* Last chance, if !unicode then try poorman links. */    if (cfg.vtmode != VT_UNICODE) {	static char poorman_scoacs[] = 	    "CueaaaaceeeiiiAAE**ooouuyOUc$YPsaiounNao?++**!<>###||||++||++++++--|-+||++--|-+----++++++++##||#aBTPEsyt******EN=+><++-=... n2* ";	static char poorman_latin1[] =	    " !cL.Y|S\"Ca<--R~o+23'u|.,1o>///?AAAAAAACEEEEIIIIDNOOOOOxOUUUUYPBaaaaaaaceeeeiiiionooooo/ouuuuypy";	static char poorman_vt100[] = "*#****o~**+++++-----++++|****L.";	for (i = 160; i < 256; i++)	    if (!DIRECT_FONT(unitab_line[i]) &&		unitab_line[i] >= 160 && unitab_line[i] < 256)		unitab_line[i] = (WCHAR) (ATTR_ACP					  + poorman_latin1[unitab_line[i] -							   160]);	for (i = 96; i < 127; i++)	    if (!DIRECT_FONT(unitab_xterm[i]))		unitab_xterm[i] =		    (WCHAR) (ATTR_ACP + poorman_vt100[i - 96]);	for(i=128;i<256;i++) 	    if (!DIRECT_FONT(unitab_scoacs[i]))		unitab_scoacs[i] = 		    (WCHAR) (ATTR_ACP + poorman_scoacs[i - 128]);    }}