aboutsummaryrefslogtreecommitdiff
path: root/emulators
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2008-05-16 14:10:38 +0000
committerMartin Wilke <miwi@FreeBSD.org>2008-05-16 14:10:38 +0000
commitdb5190e781bb68589f01c235045ad60e46b71757 (patch)
tree24a8392642c5a422a617cbd2d09c5449a98a96cb /emulators
parente1dc9f3eb1f18165d0d0611e76ab75e5241d378d (diff)
downloadports-db5190e781bb68589f01c235045ad60e46b71757.tar.gz
ports-db5190e781bb68589f01c235045ad60e46b71757.zip
- The emulators/dlx port is one of the last remaining ports that uses
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>
Notes
Notes: svn path=/head/; revision=213136
Diffstat (limited to 'emulators')
-rw-r--r--emulators/dlx/files/patch-io-termios65
1 files changed, 65 insertions, 0 deletions
diff --git a/emulators/dlx/files/patch-io-termios b/emulators/dlx/files/patch-io-termios
new file mode 100644
index 000000000000..c9a268944ee1
--- /dev/null
+++ b/emulators/dlx/files/patch-io-termios
@@ -0,0 +1,65 @@
+--- 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. */