diff --git a/main.c b/main.c index 250c5e33..b95218f8 100644 --- a/main.c +++ b/main.c @@ -213,11 +213,10 @@ main(argc, argv) if (missing_cap && !know_dumb) error("WARNING: terminal is not fully functional", NULL_PARG); init_mark(); - raw_mode(1); open_getchr(); + raw_mode(1); init_signals(1); - /* * Select the first file to examine. */ diff --git a/screen.c b/screen.c index 19d36408..65844ed7 100644 --- a/screen.c +++ b/screen.c @@ -229,6 +229,7 @@ extern int no_keypad; extern int sigs; extern int wscroll; extern int screen_trashed; +extern int tty; #if HILITE_SEARCH extern int hilite_search; #endif @@ -267,7 +268,7 @@ raw_mode(on) /* * Get terminal modes. */ - tcgetattr(2, &s); + tcgetattr(tty, &s); /* * Save modes and set certain variables dependent on modes. @@ -423,9 +424,9 @@ raw_mode(on) s = save_term; } #if HAVE_FSYNC - fsync(2); + fsync(tty); #endif - tcsetattr(2, TCSADRAIN, &s); + tcsetattr(tty, TCSADRAIN, &s); #if MUST_SET_LINE_DISCIPLINE if (!on) { @@ -435,7 +436,7 @@ raw_mode(on) * is therefore not restored, yet. Restore the old * line discipline by hand. */ - ioctl(2, TIOCSETD, &save_term.c_line); + ioctl(tty, TIOCSETD, &save_term.c_line); } #endif } @@ -451,7 +452,7 @@ raw_mode(on) /* * Get terminal modes. */ - ioctl(2, TCGETA, &s); + ioctl(tty, TCGETA, &s); /* * Save modes and set certain variables dependent on modes. @@ -487,7 +488,7 @@ raw_mode(on) */ s = save_term; } - ioctl(2, TCSETAW, &s); + ioctl(tty, TCSETAW, &s); } #else #ifdef TIOCGETP @@ -501,7 +502,7 @@ raw_mode(on) /* * Get terminal modes. */ - ioctl(2, TIOCGETP, &s); + ioctl(tty, TIOCGETP, &s); /* * Save modes and set certain variables dependent on modes. @@ -530,7 +531,7 @@ raw_mode(on) */ s = save_term; } - ioctl(2, TIOCSETN, &s); + ioctl(tty, TIOCSETN, &s); } #else #ifdef _OSK @@ -544,7 +545,7 @@ raw_mode(on) /* * Get terminal modes. */ - _gs_opt(2, &s); + _gs_opt(tty, &s); /* * Save modes and set certain variables dependent on modes. @@ -572,7 +573,7 @@ raw_mode(on) */ s = save_term; } - _ss_opt(2, &s); + _ss_opt(tty, &s); } #else /* MS-DOS, Windows, or OS2 */ diff --git a/ttyin.c b/ttyin.c index d2c7c52d..5132d89e 100644 --- a/ttyin.c +++ b/ttyin.c @@ -24,7 +24,7 @@ extern char WIN32getch(); static DWORD console_mode; #endif -static int tty; +public int tty; extern int sigs; /*