summaryrefslogtreecommitdiffstats
path: root/backgammon/teachgammon/teach.c
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2012-10-13 19:19:38 +0000
committerdholland <dholland@NetBSD.org>2012-10-13 19:19:38 +0000
commit83f2ef7227030c4b88ec1006e49d9304aa6f7be0 (patch)
tree0f69865c3aa850090b15e95a6ae7a6d599c95e11 /backgammon/teachgammon/teach.c
parentf70c1c7e831fd972c1f452e87709f5fe158e6f4d (diff)
downloadbsdgames-darwin-83f2ef7227030c4b88ec1006e49d9304aa6f7be0.tar.gz
bsdgames-darwin-83f2ef7227030c4b88ec1006e49d9304aa6f7be0.tar.zst
bsdgames-darwin-83f2ef7227030c4b88ec1006e49d9304aa6f7be0.zip
Pass the move info around instead of using it as a global.
Diffstat (limited to 'backgammon/teachgammon/teach.c')
-rw-r--r--backgammon/teachgammon/teach.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/backgammon/teachgammon/teach.c b/backgammon/teachgammon/teach.c
index 9d10908d..7559f5ad 100644
--- a/backgammon/teachgammon/teach.c
+++ b/backgammon/teachgammon/teach.c
@@ -1,4 +1,4 @@
-/* $NetBSD: teach.c,v 1.21 2010/03/22 05:10:19 mrg Exp $ */
+/* $NetBSD: teach.c,v 1.22 2012/10/13 19:19:39 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\
#if 0
static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: teach.c,v 1.21 2010/03/22 05:10:19 mrg Exp $");
+__RCSID("$NetBSD: teach.c,v 1.22 2012/10/13 19:19:39 dholland Exp $");
#endif
#endif /* not lint */
@@ -63,6 +63,7 @@ int
main(int argc __unused, char *argv[])
{
int i;
+ struct move mmstore, *mm;
/* revoke setgid privileges */
setgid(getgid());
@@ -76,12 +77,16 @@ main(int argc __unused, char *argv[])
raw.c_lflag &= ~ICANON; /* set up modes */
ospeed = cfgetospeed(&old); /* for termlib */
tflag = getcaps(getenv("TERM"));
+
+ /* need this now beceause getarg() may try to load a game */
+ mm = &mmstore;
+ move_init(mm);
#ifdef V7
while (*++argv != 0)
#else
while (*++argv != -1)
#endif
- getarg(&argv);
+ getarg(mm, &argv);
if (tflag) {
noech.c_oflag &= ~(ONLCR | OXTABS);
raw.c_oflag &= ~(ONLCR | OXTABS);
@@ -137,7 +142,7 @@ main(int argc __unused, char *argv[])
if ((i = wrtext(lastch)) != 0)
break;
}
- tutor();
+ tutor(mm);
/* NOTREACHED */
return (0);
}