lkml.org 
[lkml]   [2008]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] n-tty-fix-cont-and-ctrl-output
    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;
    }
    }
    \
     
     \ /
      Last update: 2008-10-23 03:37    [W:0.022 / U:0.744 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site