public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Peterson <joe@skyrush.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] n-tty-fix-cont-and-ctrl-output
Date: Wed, 22 Oct 2008 19:34:32 -0600	[thread overview]
Message-ID: <48FFD4A8.7050109@skyrush.com> (raw)
In-Reply-To: <20081022103259.2d04729a@lxorguk.ukuu.org.uk>

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: n-tty-fix-cont-and-ctrl-output.patch --]
[-- Type: text/plain, Size: 1348 bytes --]

Fix process_output_block to detect continuation characters correctly
and to handle control characters even when O_OLCUC is enabled.  Make
similar change to do_output_char().

Signed-off-by: Joe Peterson <joe@skyrush.com>
---

diff -Nurp a/drivers/char/n_tty.c b/drivers/char/n_tty.c
--- a/drivers/char/n_tty.c	2008-10-22 17:36:05.443340314 -0600
+++ b/drivers/char/n_tty.c	2008-10-22 17:34:38.063341826 -0600
@@ -351,10 +351,12 @@ static int do_output_char(unsigned char 
 			tty->column--;
 		break;
 	default:
-		if (O_OLCUC(tty))
-			c = toupper(c);
-		if (!iscntrl(c) && !is_continuation(c, tty))
-			tty->column++;
+		if (!iscntrl(c)) {
+			if (O_OLCUC(tty))
+				c = toupper(c);
+			if (!is_continuation(c, tty))
+				tty->column++;
+		}
 		break;
 	}
 
@@ -425,7 +427,9 @@ static ssize_t process_output_block(stru
 		nr = space;
 
 	for (i = 0, cp = buf; i < nr; i++, cp++) {
-		switch (*cp) {
+		unsigned char c = *cp;
+		
+		switch (c) {
 		case '\n':
 			if (O_ONLRET(tty))
 				tty->column = 0;
@@ -447,10 +451,12 @@ static ssize_t process_output_block(stru
 				tty->column--;
 			break;
 		default:
-			if (O_OLCUC(tty))
-				goto break_out;
-			if (!iscntrl(*cp))
-				tty->column++;
+			if (!iscntrl(c)) {
+				if (O_OLCUC(tty))
+					goto break_out;
+				if (!is_continuation(c, tty))
+					tty->column++;
+			}
 			break;
 		}
 	}

  parent reply	other threads:[~2008-10-23  1:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-13  6:01 [PATCH] fix n_tty/pty input/output buffer full and other misc char handling Joe Peterson
2008-10-13  8:40 ` Alan Cox
2008-10-22  9:32 ` Alan Cox
2008-10-22 19:35   ` Joe Peterson
2008-10-23  1:33   ` Joe Peterson
2008-10-23  1:34   ` Joe Peterson [this message]
2008-10-24  8:57     ` [PATCH] n-tty-fix-cont-and-ctrl-output Alan Cox
2008-10-23  1:35   ` [PATCH] n-tty-fix-buffer-full-checks Joe Peterson
2008-10-23  1:35   ` [PATCH] n-tty-output-bells-immediately Joe Peterson
2008-10-24  9:10     ` Alan Cox
2008-10-25 15:41       ` Joe Peterson
2008-10-25 15:48         ` Alan Cox
2008-10-25 15:53           ` Joe Peterson
2008-10-25 21:13             ` Joe Peterson
2008-10-23  1:36   ` [PATCH] n-tty-fix-buffer-full-gridlock Joe Peterson
2008-10-23  1:56     ` Andrew Morton

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=48FFD4A8.7050109@skyrush.com \
    --to=joe@skyrush.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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