forked from Lainports/freebsd-ports
sgtty exclusively. We'd better port it to termios, to make it work without the COMPAT_43TTY kernel switch. PR: 122884 Submitted by: Ed Schouten <ed@80386.nl>
65 lines
1.7 KiB
Text
65 lines
1.7 KiB
Text
--- dlxsim/io.c
|
||
+++ dlxsim/io.c
|
||
@@ -18,6 +18,8 @@
|
||
static char rcsid[] = "$Header: /user1/ouster/mipsim/RCS/io.c,v 1.3 89/12/07 18:00:21 ouster Exp $ SPRITE (Berkeley)";
|
||
#endif /* not lint */
|
||
|
||
+#include <sys/ioctl.h>
|
||
+
|
||
#include <ctype.h>
|
||
#include <stdio.h>
|
||
#include <fcntl.h>
|
||
@@ -283,17 +285,19 @@
|
||
register DLX *machPtr; /* Machine being simulated. */
|
||
{
|
||
int flags;
|
||
+ struct termios newState;
|
||
|
||
/*
|
||
* Save terminal state, and put it into a raw-er mode during
|
||
* the simulation.
|
||
*/
|
||
|
||
- ioctl(0, TIOCGETP, (char *) &(machPtr->ioState.savedState));
|
||
- flags = machPtr->ioState.savedState.sg_flags;
|
||
- machPtr->ioState.savedState.sg_flags = (flags | CBREAK) & ~ECHO;
|
||
- ioctl(0, TIOCSETP, (char *) &machPtr->ioState.savedState);
|
||
- machPtr->ioState.savedState.sg_flags = flags;
|
||
+ tcgetattr(0, &newState);
|
||
+ machPtr->ioState.savedState = newState;
|
||
+ newState.c_lflag &= ~(ICANON|ECHO);
|
||
+ newState.c_cc[VMIN] = 0;
|
||
+ newState.c_cc[VTIME] = 0;
|
||
+ tcsetattr(0, TCSANOW, &newState);
|
||
}
|
||
|
||
/*
|
||
@@ -325,7 +329,7 @@
|
||
*/
|
||
|
||
CheckInput(machPtr);
|
||
- ioctl(0, TIOCSETP, (char *) &machPtr->ioState.savedState);
|
||
+ tcsetattr(0, TCSANOW, &machPtr->ioState.savedState);
|
||
}
|
||
|
||
/*
|
||
--- dlxsim/io.h
|
||
+++ dlxsim/io.h
|
||
@@ -19,7 +19,7 @@
|
||
#ifndef _MIPSIM_IO
|
||
#define _MIPSIM_IO
|
||
|
||
-#include <sgtty.h>
|
||
+#include <termios.h>
|
||
|
||
/*
|
||
* The following structure is part of each DLX machine, and describes
|
||
@@ -27,7 +27,7 @@
|
||
*/
|
||
|
||
typedef struct IoState {
|
||
- struct sgttyb savedState; /* Used to save original terminal state
|
||
+ struct termios savedState; /* Used to save original terminal state
|
||
* so terminal can be put into CBREAK
|
||
* mode during simulation and then be
|
||
* restored when simulation stops. */
|