summaryrefslogtreecommitdiffstats
path: root/backgammon/teachgammon
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/teachgammon
parent567e3567cfbbfd9940e7ac02313f241710d726c7 (diff)
downloadbsdgames-darwin-42430ba7d7a05f98105888cb19f79d9bd7cd22ad.tar.gz
bsdgames-darwin-42430ba7d7a05f98105888cb19f79d9bd7cd22ad.zip
Use POSIX tty semantics.
Diffstat (limited to 'backgammon/teachgammon')
-rw-r--r--backgammon/teachgammon/teach.c26
-rw-r--r--backgammon/teachgammon/ttext2.c12
2 files changed, 18 insertions, 20 deletions
diff --git a/backgammon/teachgammon/teach.c b/backgammon/teachgammon/teach.c
index a1f493e8..3eaf2739 100644
--- a/backgammon/teachgammon/teach.c
+++ b/backgammon/teachgammon/teach.c
@@ -1,4 +1,4 @@
-/* $NetBSD: teach.c,v 1.3 1995/03/21 15:06:13 cgd Exp $ */
+/* $NetBSD: teach.c,v 1.4 1995/04/29 00:44:18 mycroft Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: teach.c,v 1.3 1995/03/21 15:06:13 cgd Exp $";
+static char rcsid[] = "$NetBSD: teach.c,v 1.4 1995/04/29 00:44:18 mycroft Exp $";
#endif
#endif /* not lint */
@@ -62,7 +62,7 @@ char *stragy[];
char *prog[];
char *lastch[];
-extern char ospeed; /* tty output speed for termlib */
+extern speed_t ospeed; /* tty output speed for termlib */
char *helpm[] = {
"\nEnter a space or newline to roll, or",
@@ -85,15 +85,13 @@ char **argv;
register int i;
signal (2,getout);
- if (gtty (0,&tty) == -1) /* get old tty mode */
+ if (tcgetattr (0, &old) == -1) /* get old tty mode */
errexit ("teachgammon(gtty)");
- old = tty.sg_flags;
-#ifdef V7
- raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */
-#else
- raw = ((noech = old & ~ECHO) | RAW); /* set up modes */
-#endif
- ospeed = tty.sg_ospeed; /* for termlib */
+ noech = old;
+ noech.c_lflag &= ~ECHO;
+ raw = noech;
+ raw.c_lflag &= ~ICANON; /* set up modes */
+ ospeed = cfgetospeed (&old); /* for termlib */
tflag = getcaps (getenv ("TERM"));
#ifdef V7
while (*++argv != 0)
@@ -102,8 +100,8 @@ char **argv;
#endif
getarg (&argv);
if (tflag) {
- noech &= ~(CRMOD|XTABS);
- raw &= ~(CRMOD|XTABS);
+ noech.c_oflag &= ~(ONLCR|OXTABS);
+ raw.c_oflag &= ~(ONLCR|OXTABS);
clear();
}
text (hello);
@@ -165,7 +163,7 @@ leave() {
clear();
else
writec ('\n');
- fixtty(old);
+ fixtty(&old);
execl (EXEC,"backgammon",args,"n",0);
writel ("Help! Backgammon program is missing\007!!\n");
exit (-1);
diff --git a/backgammon/teachgammon/ttext2.c b/backgammon/teachgammon/ttext2.c
index 07a857a8..afb431c1 100644
--- a/backgammon/teachgammon/ttext2.c
+++ b/backgammon/teachgammon/ttext2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ttext2.c,v 1.3 1995/03/21 15:06:22 cgd Exp $ */
+/* $NetBSD: ttext2.c,v 1.4 1995/04/29 00:44:20 mycroft Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)ttext2.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: ttext2.c,v 1.3 1995/03/21 15:06:22 cgd Exp $";
+static char rcsid[] = "$NetBSD: ttext2.c,v 1.4 1995/04/29 00:44:20 mycroft Exp $";
#endif
#endif /* not lint */
@@ -139,7 +139,7 @@ char **txt;
char *c;
int i;
- fixtty (noech);
+ fixtty (&noech);
begin = txt;
while (*txt) {
a = *(txt++);
@@ -149,7 +149,7 @@ char **txt;
writel (a);
writec ('\n');
} else {
- fixtty (raw);
+ fixtty (&raw);
writel (prompt);
for (;;) {
if ((b = readc()) == '?') {
@@ -188,12 +188,12 @@ char **txt;
writec ('\n');
if (i)
return(i);
- fixtty (noech);
+ fixtty (&noech);
if (tflag)
curmove (curr,0);
begin = txt;
}
}
- fixtty (raw);
+ fixtty (&raw);
return (0);
}