Merge pull request #78 from Humm42/master

use freopen(3) correctly
This commit is contained in:
Brian Barto 2021-01-29 19:07:51 -05:00 committed by GitHub
commit 0d0b492de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -296,7 +296,7 @@ static void nmstermio_set_terminal(int s) {
static int state = 1; static int state = 1;
if (!isatty(STDIN_FILENO)) { if (!isatty(STDIN_FILENO)) {
stdin = freopen("/dev/tty", "r", stdin); freopen("/dev/tty", "r", stdin);
} }
if (s == 0) { if (s == 0) {

View File

@ -28,7 +28,7 @@ static int foregroundColor = COLOR_BLUE; // Foreground color settin
*/ */
void nmstermio_init_terminal(void) { void nmstermio_init_terminal(void) {
if (!isatty(STDIN_FILENO)) { if (!isatty(STDIN_FILENO)) {
stdin = freopen("/dev/tty", "r", stdin); freopen("/dev/tty", "r", stdin);
} }
initscr(); initscr();
cbreak(); cbreak();