| 639 | } |
| 640 | |
| 641 | static int |
| 642 | ttydisc_echo_force(struct tty *tp, char c, int quote) |
| 643 | { |
| 644 | |
| 645 | if (CMP_FLAG(l, FLUSHO)) |
| 646 | return 0; |
| 647 | |
| 648 | if (CMP_FLAG(o, OPOST) && CTL_ECHO(c, quote)) { |
| 649 | /* |
| 650 | * Only perform postprocessing when OPOST is turned on |
| 651 | * and the character is an unquoted BS/TB/NL/CR. |
| 652 | */ |
| 653 | return ttydisc_write_oproc(tp, c); |
| 654 | } else if (CMP_FLAG(l, ECHOCTL) && CTL_PRINT(c, quote)) { |
| 655 | /* |
| 656 | * Only use ^X notation when ECHOCTL is turned on and |
| 657 | * we've got an quoted control character. |
| 658 | * |
| 659 | * Print backspaces when echoing an end-of-file. |
| 660 | */ |
| 661 | char ob[4] = "^?\b\b"; |
| 662 | |
| 663 | /* Print ^X notation. */ |
| 664 | if (c != 0x7f) |
| 665 | ob[1] = c + 'A' - 1; |
| 666 | |
| 667 | if (!quote && CMP_CC(VEOF, c)) { |
| 668 | return ttyoutq_write_nofrag(&tp->t_outq, ob, 4); |
| 669 | } else { |
| 670 | tp->t_column += 2; |
| 671 | return ttyoutq_write_nofrag(&tp->t_outq, ob, 2); |
| 672 | } |
| 673 | } else { |
| 674 | /* Can just be printed. */ |
| 675 | tp->t_column++; |
| 676 | return ttyoutq_write_nofrag(&tp->t_outq, &c, 1); |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | static int |
| 681 | ttydisc_echo(struct tty *tp, char c, int quote) |
no test coverage detected