| 1975 | |
| 1976 | static void *input_thread_main(void *arg) { |
| 1977 | (void)arg; |
| 1978 | int esc_state = 0; |
| 1979 | char buf[64]; |
| 1980 | |
| 1981 | while (global_input.running) { |
| 1982 | ssize_t n = read(STDIN_FILENO, buf, sizeof(buf)); |
| 1983 | if (n <= 0) { |
| 1984 | usleep(5000); |
| 1985 | continue; |
| 1986 | } |
| 1987 | for (ssize_t i = 0; i < n; i++) { |
| 1988 | unsigned char c = (unsigned char)buf[i]; |
| 1989 | if (esc_state == 0) { |
| 1990 | if (c == 27) esc_state = 1; |
no test coverage detected