1 /* @(#)teach.c 8.1 (Berkeley) 5/31/93 */
2 /* $NetBSD: teach.c,v 1.25 2019/02/03 03:19:25 mrg Exp $ */
5 * Copyright (c) 1980, 1993
6 * The Regents of the University of California. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 static const char *const contin[] = {
42 main(int argc __unused, char *argv[])
45 struct move mmstore, *mm;
47 /* revoke setgid privileges */
50 signal(SIGINT, getout);
51 if (tcgetattr(0, &old) == -1) /* get old tty mode */
52 errexit("teachgammon(gtty)");
54 noech.c_lflag &= ~ECHO;
56 raw.c_lflag &= ~ICANON; /* set up modes */
57 ospeed = cfgetospeed(&old); /* for termlib */
58 tflag = getcaps(getenv("TERM"));
60 /* need this now beceause getarg() may try to load a game */
66 noech.c_oflag &= ~(ONLCR | OXTABS);
67 raw.c_oflag &= ~(ONLCR | OXTABS);
82 if ((i = wrtext(intro1)) != 0)
85 if ((i = wrtext(intro2)) != 0)
90 if ((i = wrtext(moves)) != 0)
95 if ((i = wrtext(removepiece)) != 0)
100 if ((i = wrtext(hits)) != 0)
105 if ((i = wrtext(endgame)) != 0)
110 if ((i = wrtext(doubl)) != 0)
115 if ((i = wrtext(stragy)) != 0)
120 if ((i = wrtext(prog)) != 0)
125 if ((i = wrtext(lastch)) != 0)
141 execl(EXEC, "backgammon", "-n", args[0]?args:0, (char *) 0);
142 writel("Help! Backgammon program is missing\007!!\n");