/* We have a combining character DIACR here, followed by the character CH. If the combination occurs in the table, return the corresponding value. Otherwise, if CH is a space or equals DIACR, return DIACR. Otherwise, conclude that DIACR was not combining after all, queue it and return CH.  */
static unsigned int handle_diacr(struct kbd_data *kbd, unsigned int ch)
/* We have a combining character DIACR here, followed by the character CH. If the combination occurs in the table, return the corresponding value. Otherwise, if CH is a space or equals DIACR, return DIACR. Otherwise, conclude that DIACR was not combining after all, queue it and return CH.  */
static unsigned int handle_diacr(struct kbd_data *kbd, unsigned int ch)
{
	int i, d;
	d = kbd->diacr;
	kbd->diacr = 0;
	for (i = 0; i < kbd->accent_table_size; i++) {
		if (kbd->accent_table[i].diacr == d &&
		    kbd->accent_table[i].base == ch)
			return kbd->accent_table[i].result;
	}
	if (ch == ' ' || ch == d)
		return d;
	kbd_put_queue(kbd->tty, d);
	return ch;
}