Date: Tue, 12 Aug 2014 17:12:17 -0600 From: Warner Losh <imp@bsdimp.com> To: John Baldwin <jhb@FreeBSD.org> Cc: FreeBSD Stable <freebsd-stable@freebsd.org> Subject: Re: Support DISCARD (^O) Message-ID: <C2DEB4C5-8FB2-4CC0-9F87-2C927C92AE6C@bsdimp.com> In-Reply-To: <201408121644.18345.jhb@freebsd.org> References: <201408121644.18345.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_DB0F305D-2115-476B-B11A-525896BDCBD3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Aug 12, 2014, at 2:44 PM, John Baldwin <jhb@FreeBSD.org> wrote: >=20 > --=20 > John Baldwin >=20 > From: Eivind Nicolay Evensen <eivinde@terraplane.org> > Subject: Re: Support DISCARD (^O) > Date: July 5, 2014 at 4:34:16 AM MDT > To: freebsd-stable@freebsd.org >=20 >=20 > On Tue, Dec 17, 2013 at 10:18:16PM +0100, Eivind Evensen wrote: >> Hello. >>=20 >> 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. >>=20 >> Diff is against FreeBSD 8, however, last time I checked I didn't see >> much difference in the newer versions. >=20 > Here's a diff against FreeBSD 10. It seems to work fine there too. >=20 >=20 > 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); >=20 > + 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 @@ >=20 > /* 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 ^=3D FLUSHO; > + return(0); > + } > + DISCARD is supposed to turn back off after any character that you type, = not just ^O again. Warner --Apple-Mail=_DB0F305D-2115-476B-B11A-525896BDCBD3 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJT6p9RAAoJEGwc0Sh9sBEASYkP/0xhT0gQs8pGBz8NLQn1KLqX x7yhDjmhruuWBejQfLtKR/xzxinriybYUjzgnq9p46TjU909QTvy8TuY2h1X6iDh WFGeDxobraBdseaHNHrhoATizbJhXWe2ffoJX1ODou4aioL6hvyKpPXmpvv0qGes SKcJBligeVJmlPSFXe5n1d4K9DbD9ljdbc2Z314VPaOEzwduigXkDV5ssQH3DGE5 9D8J8RlMhSz4PIFVPKMCH4wB3mk9YMIjeyxuC6uRbkbpUelF6+O07XeP5rWaPyzC YbR4ljs6Jwp+wO9PAfzjdP4EhuEBQgOElDDznpm0u4H1R3Sh213pghW/yQ3Hoaux HB44YikTtUiWctGfleLoFWV1y3stMXtt0njqxoRFHSPJ4TUuEe0W3AZoqSP5HBhm iEb6jLKHECkGgKT6Wc/8EwApUKRUWzSCtnkgv6q5x18DB9NDMel2U/yZFF4+COFj xStvWNMHAhTXAWwxSV5bXH9dFYknhgZ9iAzk5Iz2YPlxSs/SBQmTUHSeC/UkekSW 40Geo49LODSCSHfxZHn9D57qYO5FV5s7VB6jtVhzwL2GFDW73JNFtmWCQRMYOwUn kIIaYtvP6rQBmaet/SH5rr9/N8spdQtejF2kYnajzF5f1k3hCyu5Jzu15v30vuOS UwHpMWjpslOfgIBxbfog =DOoy -----END PGP SIGNATURE----- --Apple-Mail=_DB0F305D-2115-476B-B11A-525896BDCBD3--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C2DEB4C5-8FB2-4CC0-9F87-2C927C92AE6C>