/* Parameters: p pointer to databuffer plus escape-character count length of buffer pluscount count of valid escape-characters so far lastplus timestamp of last character  */
static void isdn_tty_check_esc(const u_char *, u_char, int, int *, u_long *)
/* Parameters: p pointer to databuffer plus escape-character count length of buffer pluscount count of valid escape-characters so far lastplus timestamp of last character  */
static void isdn_tty_check_esc(const u_char *, u_char, int, int *, u_long *)
{
	if (plus > 127)
		return;
	if (count > 3) {
		p += count - 3;
		count = 3;
		*pluscount = 0;
	}
	while (count > 0) {
		if (*(p++) == plus) {
			if ((*pluscount)++) {
				if (time_after(jiffies, *lastplus + PLUSWAIT1))
					*pluscount = 1;
			} else {
				if (time_before(jiffies, *lastplus + PLUSWAIT2))
					*pluscount = 0;
			}
			if ((*pluscount == 3) && (count == 1))
				isdn_timer_ctrl(ISDN_TIMER_MODEMPLUS, 1);
			if (*pluscount > 3)
				*pluscount = 1;
		} else
			*pluscount = 0;
		*lastplus = jiffies;
		count--;
	}
}