summaryrefslogtreecommitdiff
path: root/games/phantasia/main.c
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1998-07-10 09:46:51 +0000
committerJason Downs <downsj@cvs.openbsd.org>1998-07-10 09:46:51 +0000
commit647b5aee594733617c2f9923dfe5f3c760a12a66 (patch)
tree5c3cb1fb147fba884dc80857b1d82ae59954a46b /games/phantasia/main.c
parent85e3e24a7b27bab591efff2a4f4d917dc00f91f4 (diff)
Ok, so I was bored and couldn't sleep...
Make this sucker work with decent terminal settings.
Diffstat (limited to 'games/phantasia/main.c')
-rw-r--r--games/phantasia/main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/games/phantasia/main.c b/games/phantasia/main.c
index 01949a95592..4795c679659 100644
--- a/games/phantasia/main.c
+++ b/games/phantasia/main.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: main.c,v 1.4 1998/07/10 09:46:47 downsj Exp $ */
/* $NetBSD: main.c,v 1.3 1995/04/24 12:24:37 cgd Exp $ */
/*
@@ -29,6 +30,9 @@
#include <sys/types.h>
#include <pwd.h>
+#ifdef TERMIOS
+#include <termios.h>
+#endif
/*
* The program allocates as much file space as it needs to store characters,
@@ -338,6 +342,10 @@ double dtemp; /* for temporary calculations */
initialstate()
{
+#ifdef TERMIOS
+ struct termios tty;
+#endif
+
Beyond = FALSE;
Marsh = FALSE;
Throne = FALSE;
@@ -348,6 +356,20 @@ initialstate()
Windows = FALSE;
Echo = TRUE;
+#ifdef TERMIOS
+ /* setup terminal keys */
+ if (tcgetattr(0, &tty) == 0) {
+ Ch_Erase = tty.c_cc[VERASE];
+ Ch_Kill = tty.c_cc[VKILL];
+ } else {
+ Ch_Erase = CH_ERASE;
+ Ch_Kill = CH_KILL;
+ }
+#else
+ Ch_Erase = CH_ERASE;
+ Ch_Kill = CH_KILL;
+#endif
+
/* setup login name */
if ((Login = getlogin()) == NULL)
Login = getpwuid(getuid())->pw_name;