aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJoe Peterson <joe@skyrush.com>2009-01-02 08:43:25 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 13:19:37 -0500
commita59c0d6f14315a3f300f6f3786137213727e4c47 (patch)
treea6cccef67a4ed016242f67a9a6136b7bc2a72fff /drivers/char
parentfc6f6238226e6d1248e1967eae2bf556eaf3ac17 (diff)
n_tty: Fix handling of control characters and continuations
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> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/n_tty.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index a223823544bf..30b0426b3788 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -351,10 +351,12 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
351 tty->column--; 351 tty->column--;
352 break; 352 break;
353 default: 353 default:
354 if (O_OLCUC(tty)) 354 if (!iscntrl(c)) {
355 c = toupper(c); 355 if (O_OLCUC(tty))
356 if (!iscntrl(c) && !is_continuation(c, tty)) 356 c = toupper(c);
357 tty->column++; 357 if (!is_continuation(c, tty))
358 tty->column++;
359 }
358 break; 360 break;
359 } 361 }
360 362
@@ -425,7 +427,9 @@ static ssize_t process_output_block(struct tty_struct *tty,
425 nr = space; 427 nr = space;
426 428
427 for (i = 0, cp = buf; i < nr; i++, cp++) { 429 for (i = 0, cp = buf; i < nr; i++, cp++) {
428 switch (*cp) { 430 unsigned char c = *cp;
431
432 switch (c) {
429 case '\n': 433 case '\n':
430 if (O_ONLRET(tty)) 434 if (O_ONLRET(tty))
431 tty->column = 0; 435 tty->column = 0;
@@ -447,10 +451,12 @@ static ssize_t process_output_block(struct tty_struct *tty,
447 tty->column--; 451 tty->column--;
448 break; 452 break;
449 default: 453 default:
450 if (O_OLCUC(tty)) 454 if (!iscntrl(c)) {
451 goto break_out; 455 if (O_OLCUC(tty))
452 if (!iscntrl(*cp)) 456 goto break_out;
453 tty->column++; 457 if (!is_continuation(c, tty))
458 tty->column++;
459 }
454 break; 460 break;
455 } 461 }
456 } 462 }