Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Dec 2013 18:09:46 +0400
From:      Slawa Olhovchenkov <slw@zxy.spb.ru>
To:        Eivind Evensen <eivinde@terraplane.org>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Support DISCARD (^O)
Message-ID:  <20131226140946.GA43173@zxy.spb.ru>
In-Reply-To: <20131217211816.GA41797@klump.hjerdalen.lokalnett>
References:  <20131217211816.GA41797@klump.hjerdalen.lokalnett>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 17, 2013 at 10:18:16PM +0100, Eivind Evensen wrote:

> Hello.
> 
> I don't know if there is any particular reason that support for DISCARD/^O
> was not included in the tty rewrite that happened from FreeBSD 7 to 8,
> but in case anybody else wants it, here's a diff functioning mostly
> like in 7, except output isn't switched back on automatically on input.
> 
> Diff is against FreeBSD 8, however, last time I checked I didn't see
> much difference in the newer versions.
> 
> Regards, Eivind

Nice! Very nice feature, need to commit in the tree.

> diff -r 91820d9948e0 -r 13f40d577646 sys/kern/tty_ttydisc.c
> --- a/sys/kern/tty_ttydisc.c	Fri Feb 22 09:45:32 2013 +0100
> +++ b/sys/kern/tty_ttydisc.c	Tue Dec 17 23:03:17 2013 +0100
> @@ -448,6 +448,9 @@
>  	if (tp->t_flags & TF_ZOMBIE)
>  		return (EIO);
>  
> +	if (tp->t_termios.c_lflag & FLUSHO)
> +		return (0);
> +
>  	/*
>  	 * We don't need to check whether the process is the foreground
>  	 * process group or if we have a carrier. This is already done
> @@ -881,6 +884,14 @@
>  
>  	/* Special control characters that are implementation dependent. */
>  	if (CMP_FLAG(l, IEXTEN)) {
> +		/* Discard (^O) */
> +		if (CMP_CC(VDISCARD, c)) {
> +			if (!(tp->t_termios.c_lflag & FLUSHO))
> +				ttyoutq_write_nofrag(&tp->t_outq, "^O", 2);
> +			tp->t_termios.c_lflag ^= FLUSHO;
> +			return(0);
> +		}
> +
>  		/* Accept the next character as literal. */
>  		if (CMP_CC(VLNEXT, c)) {
>  			if (CMP_FLAG(l, ECHO)) {
> _______________________________________________
> freebsd-stable@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131226140946.GA43173>