wow - loopback in sim actually worksgit status
This commit is contained in:
parent
ad1bdfc8b1
commit
9f90b00b25
10 changed files with 96 additions and 261 deletions
|
@ -2,6 +2,22 @@
|
|||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
static volatile bool ctrl_c_received = false;
|
||||
|
||||
void sigint_handler(int sig_num) {
|
||||
ctrl_c_received = true;
|
||||
}
|
||||
|
||||
void setup_sigint_handler() {
|
||||
signal(SIGINT, sigint_handler);
|
||||
}
|
||||
|
||||
bool was_ctrl_c_received() {
|
||||
return ctrl_c_received;
|
||||
}
|
||||
|
||||
static struct termios oldt, newt;
|
||||
|
||||
|
@ -25,6 +41,11 @@ char get_char_from_terminal() {
|
|||
return c;
|
||||
}
|
||||
|
||||
void write_char_to_terminal(char chr) {
|
||||
putchar(chr);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
int is_char_available() {
|
||||
struct timeval tv;
|
||||
fd_set read_fd_set;
|
||||
|
|
Reference in a new issue