diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/n_tty.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index e6eeeb234e5d..2e50f4dfc79c 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -576,33 +576,23 @@ static void process_echoes(struct tty_struct *tty) | |||
576 | break; | 576 | break; |
577 | 577 | ||
578 | default: | 578 | default: |
579 | if (iscntrl(op)) { | ||
580 | if (L_ECHOCTL(tty)) { | ||
581 | /* | ||
582 | * Ensure there is enough space | ||
583 | * for the whole ctrl pair. | ||
584 | */ | ||
585 | if (space < 2) { | ||
586 | no_space_left = 1; | ||
587 | break; | ||
588 | } | ||
589 | tty_put_char(tty, '^'); | ||
590 | tty_put_char(tty, op ^ 0100); | ||
591 | tty->column += 2; | ||
592 | space -= 2; | ||
593 | } else { | ||
594 | if (!space) { | ||
595 | no_space_left = 1; | ||
596 | break; | ||
597 | } | ||
598 | tty_put_char(tty, op); | ||
599 | space--; | ||
600 | } | ||
601 | } | ||
602 | /* | 579 | /* |
603 | * If above falls through, this was an | 580 | * If the op is not a special byte code, |
604 | * undefined op. | 581 | * it is a ctrl char tagged to be echoed |
582 | * as "^X" (where X is the letter | ||
583 | * representing the control char). | ||
584 | * Note that we must ensure there is | ||
585 | * enough space for the whole ctrl pair. | ||
586 | * | ||
605 | */ | 587 | */ |
588 | if (space < 2) { | ||
589 | no_space_left = 1; | ||
590 | break; | ||
591 | } | ||
592 | tty_put_char(tty, '^'); | ||
593 | tty_put_char(tty, op ^ 0100); | ||
594 | tty->column += 2; | ||
595 | space -= 2; | ||
606 | cp += 2; | 596 | cp += 2; |
607 | nr -= 2; | 597 | nr -= 2; |
608 | } | 598 | } |
@@ -809,8 +799,8 @@ static void echo_char_raw(unsigned char c, struct tty_struct *tty) | |||
809 | * Echo user input back onto the screen. This must be called only when | 799 | * Echo user input back onto the screen. This must be called only when |
810 | * L_ECHO(tty) is true. Called from the driver receive_buf path. | 800 | * L_ECHO(tty) is true. Called from the driver receive_buf path. |
811 | * | 801 | * |
812 | * This variant tags control characters to be possibly echoed as | 802 | * This variant tags control characters to be echoed as "^X" |
813 | * as "^X" (where X is the letter representing the control char). | 803 | * (where X is the letter representing the control char). |
814 | * | 804 | * |
815 | * Locking: echo_lock to protect the echo buffer | 805 | * Locking: echo_lock to protect the echo buffer |
816 | */ | 806 | */ |
@@ -823,7 +813,7 @@ static void echo_char(unsigned char c, struct tty_struct *tty) | |||
823 | add_echo_byte(ECHO_OP_START, tty); | 813 | add_echo_byte(ECHO_OP_START, tty); |
824 | add_echo_byte(ECHO_OP_START, tty); | 814 | add_echo_byte(ECHO_OP_START, tty); |
825 | } else { | 815 | } else { |
826 | if (iscntrl(c) && c != '\t') | 816 | if (L_ECHOCTL(tty) && iscntrl(c) && c != '\t') |
827 | add_echo_byte(ECHO_OP_START, tty); | 817 | add_echo_byte(ECHO_OP_START, tty); |
828 | add_echo_byte(c, tty); | 818 | add_echo_byte(c, tty); |
829 | } | 819 | } |