From: Joe Peterson <joe@skyrush.com>
To: linux-kernel@vger.kernel.org, alan@redhat.com
Subject: [PATCH] Enabling the echo of ctrl-C (and the like)
Date: Thu, 06 Dec 2007 12:21:55 -0700 [thread overview]
Message-ID: <47584BD3.8080306@skyrush.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 722 bytes --]
Attached is a patch that turns on INTR/QUIT/SUSP echoing in the N_TTY
line discipline (e.g. ctrl-C will appear as "^C" if stty echoctl is set
and ctrl-C is set as INTR).
Linux seems to be the only unix-like OS (recently I've verified this on
Solaris, BSD, and Mac OS X) that does *not* behave this way, and I
really miss this as a good visual confirmation of the interrupt of a
program in the console or xterm. I remember this fondly from many Unixs
I've used over the years as well. Bringing this to Linux also seems
like a good way to make it yet more compliant with standard unix-like
behavior.
The fix is pretty trivial. Let me know if you think this is a candidate
for inclusion in the kernel.
Thanks, Joe
[-- Attachment #2: echo-ctrl-c.patch --]
[-- Type: text/plain, Size: 734 bytes --]
--- linux-2.6.22-gentoo-r9/drivers/char/n_tty.c 2007-07-08 17:32:17.000000000 -0600
+++ linux-2.6.22-gentoo-r9.new/drivers/char/n_tty.c 2007-12-06 07:16:56.000000000 -0700
@@ -760,7 +760,22 @@
signal = SIGTSTP;
if (c == SUSP_CHAR(tty)) {
send_signal:
- isig(signal, tty, 0);
+ /*
+ * Echo character, and then send the signal.
+ * Note that we do not use isig() here because we want
+ * the order to be:
+ * 1) flush, 2) echo, 3) signal
+ */
+ if (!L_NOFLSH(tty)) {
+ n_tty_flush_buffer(tty);
+ if (tty->driver->flush_buffer)
+ tty->driver->flush_buffer(tty);
+ }
+ if (L_ECHO(tty)) {
+ echo_char(c, tty);
+ }
+ if (tty->pgrp)
+ kill_pgrp(tty->pgrp, signal, 1);
return;
}
}
next reply other threads:[~2007-12-06 19:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-06 19:21 Joe Peterson [this message]
2007-12-06 19:36 ` [PATCH] Enabling the echo of ctrl-C (and the like) Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47584BD3.8080306@skyrush.com \
--to=joe@skyrush.com \
--cc=alan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox