Skip to content

Commit

Permalink
Use file descriptor in tty variable rather than 2 to set raw mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwsw committed Apr 22, 2002
1 parent 07331d9 commit 1b4bf2b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
3 changes: 1 addition & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
21 changes: 11 additions & 10 deletions screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
{
Expand All @@ -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
}
Expand All @@ -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.
Expand Down Expand Up @@ -487,7 +488,7 @@ raw_mode(on)
*/
s = save_term;
}
ioctl(2, TCSETAW, &s);
ioctl(tty, TCSETAW, &s);
}
#else
#ifdef TIOCGETP
Expand All @@ -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.
Expand Down Expand Up @@ -530,7 +531,7 @@ raw_mode(on)
*/
s = save_term;
}
ioctl(2, TIOCSETN, &s);
ioctl(tty, TIOCSETN, &s);
}
#else
#ifdef _OSK
Expand All @@ -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.
Expand Down Expand Up @@ -572,7 +573,7 @@ raw_mode(on)
*/
s = save_term;
}
_ss_opt(2, &s);
_ss_opt(tty, &s);
}
#else
/* MS-DOS, Windows, or OS2 */
Expand Down
2 changes: 1 addition & 1 deletion ttyin.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern char WIN32getch();
static DWORD console_mode;
#endif

static int tty;
public int tty;
extern int sigs;

/*
Expand Down

0 comments on commit 1b4bf2b

Please sign in to comment.