summaryrefslogtreecommitdiffstats
path: root/backgammon/common_source
diff options
context:
space:
mode:
authormycroft <mycroft@NetBSD.org>1995-04-29 00:44:03 +0000
committermycroft <mycroft@NetBSD.org>1995-04-29 00:44:03 +0000
commit42430ba7d7a05f98105888cb19f79d9bd7cd22ad (patch)
treeaa3516e56353d97671cf6c67335ebf60a1ca8b61 /backgammon/common_source
parent567e3567cfbbfd9940e7ac02313f241710d726c7 (diff)
downloadbsdgames-darwin-42430ba7d7a05f98105888cb19f79d9bd7cd22ad.tar.gz
bsdgames-darwin-42430ba7d7a05f98105888cb19f79d9bd7cd22ad.tar.zst
bsdgames-darwin-42430ba7d7a05f98105888cb19f79d9bd7cd22ad.zip
Use POSIX tty semantics.
Diffstat (limited to 'backgammon/common_source')
-rw-r--r--backgammon/common_source/back.h9
-rw-r--r--backgammon/common_source/board.c8
-rw-r--r--backgammon/common_source/init.c6
-rw-r--r--backgammon/common_source/save.c6
-rw-r--r--backgammon/common_source/subs.c13
-rw-r--r--backgammon/common_source/table.c12
6 files changed, 25 insertions, 29 deletions
diff --git a/backgammon/common_source/back.h b/backgammon/common_source/back.h
index 567c936b..b1be7582 100644
--- a/backgammon/common_source/back.h
+++ b/backgammon/common_source/back.h
@@ -1,4 +1,4 @@
-/* $NetBSD: back.h,v 1.4 1995/04/24 12:22:06 cgd Exp $ */
+/* $NetBSD: back.h,v 1.5 1995/04/29 00:44:10 mycroft Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -35,7 +35,7 @@
* @(#)back.h 8.1 (Berkeley) 5/31/93
*/
-#include <sgtty.h>
+#include <termios.h>
#include <stdlib.h>
#include <string.h>
@@ -118,10 +118,7 @@ char **colorptr; /* color of current player */
char **Colorptr; /* color of current player, capitalized */
int colen; /* length of color of current player */
-struct sgttyb tty; /* tty information buffer */
-int old; /* original tty status */
-int noech; /* original tty status without echo */
-int raw; /* raw tty status, no echo */
+struct termios old, noech, raw;/* original tty status */
int curr; /* row position of cursor */
int curc; /* column position of cursor */
diff --git a/backgammon/common_source/board.c b/backgammon/common_source/board.c
index 4936b18a..eab49a43 100644
--- a/backgammon/common_source/board.c
+++ b/backgammon/common_source/board.c
@@ -1,4 +1,4 @@
-/* $NetBSD: board.c,v 1.3 1995/03/21 15:05:34 cgd Exp $ */
+/* $NetBSD: board.c,v 1.4 1995/04/29 00:44:11 mycroft Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)board.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: board.c,v 1.3 1995/03/21 15:05:34 cgd Exp $";
+static char rcsid[] = "$NetBSD: board.c,v 1.4 1995/04/29 00:44:11 mycroft Exp $";
#endif
#endif /* not lint */
@@ -53,7 +53,7 @@ wrboard () {
static char sv[] =
"| | | | \n";
- fixtty (noech);
+ fixtty (&noech);
clear();
if (tflag) {
@@ -159,7 +159,7 @@ lastline:
writec ('\n');
writec ('\n');
}
- fixtty(raw);
+ fixtty(&raw);
}
wrbsub () {
diff --git a/backgammon/common_source/init.c b/backgammon/common_source/init.c
index c11d41a6..0f8077eb 100644
--- a/backgammon/common_source/init.c
+++ b/backgammon/common_source/init.c
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.3 1995/03/21 15:05:44 cgd Exp $ */
+/* $NetBSD: init.c,v 1.4 1995/04/29 00:44:12 mycroft Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -37,11 +37,11 @@
#if 0
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: init.c,v 1.3 1995/03/21 15:05:44 cgd Exp $";
+static char rcsid[] = "$NetBSD: init.c,v 1.4 1995/04/29 00:44:12 mycroft Exp $";
#endif
#endif /* not lint */
-#include <sgtty.h>
+#include <termios.h>
/*
* variable initialization.
diff --git a/backgammon/common_source/save.c b/backgammon/common_source/save.c
index bba3dddb..aa86cecf 100644
--- a/backgammon/common_source/save.c
+++ b/backgammon/common_source/save.c
@@ -1,4 +1,4 @@
-/* $NetBSD: save.c,v 1.3 1995/03/21 15:05:52 cgd Exp $ */
+/* $NetBSD: save.c,v 1.4 1995/04/29 00:44:13 mycroft Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: save.c,v 1.3 1995/03/21 15:05:52 cgd Exp $";
+static char rcsid[] = "$NetBSD: save.c,v 1.4 1995/04/29 00:44:13 mycroft Exp $";
#endif
#endif /* not lint */
@@ -79,7 +79,7 @@ register int n;
writel (prompt);
fs = fname;
while ((*fs = readc()) != '\n') {
- if (*fs == tty.sg_erase) {
+ if (*fs == old.c_cc[VERASE]) {
if (fs > fname) {
fs--;
if (tflag)
diff --git a/backgammon/common_source/subs.c b/backgammon/common_source/subs.c
index f6ca2b58..9fb185fe 100644
--- a/backgammon/common_source/subs.c
+++ b/backgammon/common_source/subs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: subs.c,v 1.4 1995/04/24 12:22:12 cgd Exp $ */
+/* $NetBSD: subs.c,v 1.5 1995/04/29 00:44:15 mycroft Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)subs.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: subs.c,v 1.4 1995/04/24 12:22:12 cgd Exp $";
+static char rcsid[] = "$NetBSD: subs.c,v 1.5 1995/04/29 00:44:15 mycroft Exp $";
#endif
#endif /* not lint */
@@ -413,14 +413,13 @@ wrscore () {
wrint (wscore);
}
-fixtty (mode)
-int mode;
+fixtty (t)
+struct termios *t;
{
if (tflag)
newpos();
buflush();
- tty.sg_flags = mode;
- if (stty (0,&tty) < 0)
+ if (tcsetattr (0, TCSADRAIN, t) < 0)
errexit("fixtty");
}
@@ -433,7 +432,7 @@ getout () {
writec ('\n');
/* fix terminal status */
- fixtty (old);
+ fixtty (&old);
exit(0);
}
roll () {
diff --git a/backgammon/common_source/table.c b/backgammon/common_source/table.c
index c330628d..8c8329db 100644
--- a/backgammon/common_source/table.c
+++ b/backgammon/common_source/table.c
@@ -1,4 +1,4 @@
-/* $NetBSD: table.c,v 1.3 1995/03/21 15:05:58 cgd Exp $ */
+/* $NetBSD: table.c,v 1.4 1995/04/29 00:44:16 mycroft Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: table.c,v 1.3 1995/03/21 15:05:58 cgd Exp $";
+static char rcsid[] = "$NetBSD: table.c,v 1.4 1995/04/29 00:44:16 mycroft Exp $";
#endif
#endif /* not lint */
@@ -118,11 +118,11 @@ dochar:
}
}
- if (c == tty.sg_erase && ncin > 0) {
+ if (c == old.c_cc[VERASE] && ncin > 0) {
if (tflag)
curmove (curr,curc-1);
else {
- if (tty.sg_erase == '\010')
+ if (old.c_cc[VERASE] == '\010')
writel ("\010 \010");
else
writec (cin[ncin-1]);
@@ -139,13 +139,13 @@ dochar:
goto domove;
}
- if (c == tty.sg_kill && ncin > 0) {
+ if (c == old.c_cc[VKILL] && ncin > 0) {
if (tflag) {
refresh();
curmove (curr,39);
ist = -1;
goto domove;
- } else if (tty.sg_erase == '\010') {
+ } else if (old.c_cc[VERASE] == '\010') {
for (j = 0; j < ncin; j++)
writel ("\010 \010");
ist = -1;