Beispiel #1
0
/*
 * Send the contents of the canonical queue to the interactive object.
 */
static void
telnet_eol(telnet_t *tp)
{
    char *cp;

    if (tp->t_flags & TF_SYNCH)
	return;

    if (nq_full(tp->t_canq))
    {
	tp->t_flags &= ~TF_OVFLCANQ;
	cp = "";
    }
    else
    {
	nq_putc(tp->t_canq, '\0');
	cp = (char *)nq_rptr(tp->t_canq);
    }

    if (tp->t_flags & TF_ATTACH)
	interactive_input(tp->t_ip, cp);

    nq_init(tp->t_canq);

    tp->t_flags &= ~TF_GA;
}
Beispiel #2
0
static void
telnet_interactive(void *vp)
{
    telnet_t *tp = vp;
    char *cp;
    
    if (!(tp->t_flags & TF_ATTACH)) {
	tp->task = NULL;
	telnet_shutdown(tp->t_nd, tp);
	return;
    }
    if (tp->t_flags & TF_DISCONNECT) {
	tp->t_flags &= ~TF_DISCONNECT;
	if (tp->t_ip)
	    remove_interactive(tp->t_ip, 1);
    }
    if (!(tp->t_flags & TF_ATTACH)) {
	tp->task = NULL;
	telnet_shutdown(tp->t_nd, tp);
	return;
    }
    if (tp->t_flags & TF_OVFLOUTQ) {
	tp->task = NULL;
	return;
    }
    if (tp->t_flags & TF_INPUT) {
	tp->t_flags &= ~TF_INPUT;
	if (nq_full(tp->t_canq))
	    cp = "";
	else
	    cp = (char *)nq_rptr(tp->t_canq);
	interactive_input(tp->t_ip, cp);
	nq_init(tp->t_canq);
    }
    if (!(tp->t_flags & TF_ATTACH)) {
	tp->task = NULL;
	telnet_shutdown(tp->t_nd, tp);
	return;
    }
    tp->t_flags &= ~TF_GA;
    telnet_readbytes(tp->t_nd, tp);
    telnet_input(tp);
    if (!(tp->t_flags & TF_ATTACH)) {
	tp->task = NULL;
	telnet_shutdown(tp->t_nd, tp);
	return;
    }
    if (tp->t_flags & (TF_INPUT|TF_DISCONNECT)) {
	reschedule_task(tp->task);
	return;
    }
    tp->task = NULL;
    nd_enable(tp->t_nd, ND_R);
}