| 852 | } |
| 853 | |
| 854 | int |
| 855 | ttydisc_rint(struct tty *tp, char c, int flags) |
| 856 | { |
| 857 | int signal, quote = 0; |
| 858 | char ob[3] = { 0xff, 0x00 }; |
| 859 | size_t ol; |
| 860 | |
| 861 | tty_assert_locked(tp); |
| 862 | |
| 863 | atomic_add_long(&tty_nin, 1); |
| 864 | |
| 865 | if (ttyhook_hashook(tp, rint)) |
| 866 | return ttyhook_rint(tp, c, flags); |
| 867 | |
| 868 | if (tp->t_flags & TF_BYPASS) |
| 869 | goto processed; |
| 870 | |
| 871 | if (flags) { |
| 872 | if (flags & TRE_BREAK) { |
| 873 | if (CMP_FLAG(i, IGNBRK)) { |
| 874 | /* Ignore break characters. */ |
| 875 | return (0); |
| 876 | } else if (CMP_FLAG(i, BRKINT)) { |
| 877 | /* Generate SIGINT on break. */ |
| 878 | tty_flush(tp, FREAD|FWRITE); |
| 879 | tty_signal_pgrp(tp, SIGINT); |
| 880 | return (0); |
| 881 | } else { |
| 882 | /* Just print it. */ |
| 883 | goto parmrk; |
| 884 | } |
| 885 | } else if (flags & TRE_FRAMING || |
| 886 | (flags & TRE_PARITY && CMP_FLAG(i, INPCK))) { |
| 887 | if (CMP_FLAG(i, IGNPAR)) { |
| 888 | /* Ignore bad characters. */ |
| 889 | return (0); |
| 890 | } else { |
| 891 | /* Just print it. */ |
| 892 | goto parmrk; |
| 893 | } |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | /* Allow any character to perform a wakeup. */ |
| 898 | if (CMP_FLAG(i, IXANY)) { |
| 899 | tp->t_flags &= ~TF_STOPPED; |
| 900 | tp->t_termios.c_lflag &= ~FLUSHO; |
| 901 | } |
| 902 | |
| 903 | /* Remove the top bit. */ |
| 904 | if (CMP_FLAG(i, ISTRIP)) |
| 905 | c &= ~0x80; |
| 906 | |
| 907 | /* Skip input processing when we want to print it literally. */ |
| 908 | if (tp->t_flags & TF_LITERAL) { |
| 909 | tp->t_flags &= ~TF_LITERAL; |
| 910 | quote = 1; |
| 911 | goto processed; |
no test coverage detected