void luni_send(wchar_t * widebuf, int len, int interactive)
void luni_send(void *ldisc, wchar_t * widebuf, int len, int interactive)
void luni_send(wchar_t * widebuf, int len, int interactive){    static char *linebuffer = 0;    static int linesize = 0;    int ratio = (in_utf(term))?3:1;    int i;    char *p;    if (len * ratio > linesize) {	sfree(linebuffer);	linebuffer = smalloc(len * ratio * 2 * sizeof(wchar_t));	linesize = len * ratio * 2;    }    if (in_utf(term)) {	/* UTF is a simple algorithm */	for (p = linebuffer, i = 0; i < len; i++) {	    wchar_t ch = widebuf[i];	    /* Windows wchar_t is UTF-16 */	    if ((ch&0xF800) == 0xD800) ch = '.';	    if (ch < 0x80) {		*p++ = (char) (ch);	    } else if (ch < 0x800) {		*p++ = (0xC0 | (ch >> 6));		*p++ = (0x80 | (ch & 0x3F));	    } else {		*p++ = (0xE0 | (ch >> 12));		*p++ = (0x80 | ((ch >> 6) & 0x3F));		*p++ = (0x80 | (ch & 0x3F));	    }	}    } else if (!uni_tbl) {	int rv;	rv = wc_to_mb(line_codepage, 0, widebuf, len,		      linebuffer, linesize, NULL, NULL);	if (rv >= 0)	    p = linebuffer + rv;	else	    p = linebuffer;    } else {	/* Others are a lookup in an array */	for (p = linebuffer, i = 0; i < len; i++) {	    wchar_t ch = widebuf[i];	    int by;	    char *p1;	    if (uni_tbl && (p1 = uni_tbl[(ch >> 8) & 0xFF])		&& (by = p1[ch & 0xFF]))		*p++ = by;	    else if (ch < 0x80)		*p++ = (char) ch;#if 1	    else		*p++ = '.';#endif	}    }    if (p > linebuffer)	ldisc_send(linebuffer, p - linebuffer, interactive);}