On Aug 12, 2014, at 2:44 PM, John Baldwin <jhb at FreeBSD.org> wrote:
> 
> -- 
> John Baldwin
> 
> From: Eivind Nicolay Evensen <eivinde at terraplane.org>
> Subject: Re: Support DISCARD (^O)
> Date: July 5, 2014 at 4:34:16 AM MDT
> To: freebsd-stable at freebsd.org
> 
> 
> 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.
> 
> Here's a diff against FreeBSD 10. It seems to work fine there too.
> 
> 
> diff -r 59ad9c4b7916 -r 6e500f4552b4 sys/kern/tty_ttydisc.c
> --- a/sys/kern/tty_ttydisc.c	Fri Jul 04 17:27:59 2014 +0200
> +++ b/sys/kern/tty_ttydisc.c	Fri Jul 04 17:29:29 2014 +0200
> @@ -464,6 +464,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
> @@ -896,6 +899,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);
> +		}
> +
DISCARD is supposed to turn back off after any character that you type, not just
^O again.
Warner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL:
<http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20140812/467e5088/attachment.sig>