From d090436c780921850b4e4f9a295852e2fc403485 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 8 May 2018 21:37:39 -0700 Subject: [PATCH] SCP: Support host environments which can't do termios TCSAFLUSH --- sim_console.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sim_console.c b/sim_console.c index fc35d801..bea49c75 100644 --- a/sim_console.c +++ b/sim_console.c @@ -3928,6 +3928,12 @@ return SCPE_OK; #else +#if !defined(CANT_USE_TERMIOS_TCSAFLUSH) +#define TCSETATTR_ACTION TCSAFLUSH +#else +#define TCSETATTR_ACTION TCSANOW +#endif + #include #include @@ -3988,7 +3994,7 @@ runtty.c_cc[VINTR] = 0; /* OS X doesn't deliver #else runtty.c_cc[VINTR] = sim_int_char; /* in case changed */ #endif -if (tcsetattr (fileno(stdin), TCSAFLUSH, &runtty) < 0) +if (tcsetattr (fileno(stdin), TCSETATTR_ACTION, &runtty) < 0) return SCPE_TTIERR; sim_os_set_thread_priority (PRIORITY_BELOW_NORMAL); /* try to lower pri */ return SCPE_OK; @@ -3999,7 +4005,7 @@ static t_stat sim_os_ttcmd (void) if (!isatty (fileno (stdin))) /* skip if !tty */ return SCPE_OK; sim_os_set_thread_priority (PRIORITY_NORMAL); /* try to raise pri */ -if (tcsetattr (fileno(stdin), TCSAFLUSH, &cmdtty) < 0) +if (tcsetattr (fileno(stdin), TCSETATTR_ACTION, &cmdtty) < 0) return SCPE_TTIERR; return SCPE_OK; }