| 371 | #endif |
| 372 | |
| 373 | void term_init(void) |
| 374 | { |
| 375 | #if HAVE_TERMIOS_H |
| 376 | if (!run_as_daemon && stdin_interaction) { |
| 377 | struct termios tty; |
| 378 | if (tcgetattr (0, &tty) == 0) { |
| 379 | oldtty = tty; |
| 380 | restore_tty = 1; |
| 381 | |
| 382 | tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP |
| 383 | |INLCR|IGNCR|ICRNL|IXON); |
| 384 | tty.c_oflag |= OPOST; |
| 385 | tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); |
| 386 | tty.c_cflag &= ~(CSIZE|PARENB); |
| 387 | tty.c_cflag |= CS8; |
| 388 | tty.c_cc[VMIN] = 1; |
| 389 | tty.c_cc[VTIME] = 0; |
| 390 | |
| 391 | tcsetattr (0, TCSANOW, &tty); |
| 392 | } |
| 393 | signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */ |
| 394 | } |
| 395 | #endif |
| 396 | |
| 397 | signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */ |
| 398 | signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */ |
| 399 | #ifdef SIGXCPU |
| 400 | signal(SIGXCPU, sigterm_handler); |
| 401 | #endif |
| 402 | #if HAVE_SETCONSOLECTRLHANDLER |
| 403 | SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE); |
| 404 | #endif |
| 405 | } |
| 406 | |
| 407 | /* read a key without blocking */ |
| 408 | static int read_key(void) |
no outgoing calls
no test coverage detected