1 /* $OpenBSD: init.c,v 1.5 2001/06/23 23:50:03 pjanzen Exp $ */ 2 3 /* 4 * Copyright (c) 1980, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by the University of 18 * California, Berkeley and its contributors. 19 * 4. Neither the name of the University nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35 36 #ifndef lint 37 #if 0 38 static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93"; 39 #else 40 static char rcsid[] = "$OpenBSD: init.c,v 1.5 2001/06/23 23:50:03 pjanzen Exp $"; 41 #endif 42 #endif /* not lint */ 43 44 /* 45 * variable initialization. 46 */ 47 48 #ifdef DEBUG 49 #include <stdio.h> 50 FILE *trace; 51 #endif 52 53 /* name of executable object programs */ 54 const char EXEC[] = "/usr/games/backgammon"; 55 const char TEACH[] = "/usr/games/teachgammon"; 56 57 int pnum = 2; /* color of player: 58 -1 = white 59 1 = red 60 0 = both 61 2 = not yet init'ed */ 62 int acnt = 0; /* length of args */ 63 int aflag = 1; /* flag to ask for rules or instructions */ 64 int cflag = 0; /* case conversion flag */ 65 int hflag = 1; /* flag for cleaning screen */ 66 int mflag = 0; /* backgammon flag */ 67 int raflag = 0; /* 'roll again' flag for recovered game */ 68 int rflag = 0; /* recovered game flag */ 69 int iroll = 0; /* special flag for inputting rolls */ 70 int rfl = 0; 71 72 const char *const color[] = {"White", "Red", "white", "red"}; 73 74 75 const char *const *Colorptr; 76 const char *const *colorptr; 77 int *inopp; 78 int *inptr; 79 int *offopp; 80 int *offptr; 81 char args[100]; 82 int bar; 83 int begscr; 84 int board[26]; 85 char cin[100]; 86 int colen; 87 int cturn; 88 int d0; 89 int dice[2]; 90 int dlast; 91 int g[5]; 92 int gvalue; 93 int h[4]; 94 int home; 95 int in[2]; 96 int mvl; 97 int mvlim; 98 int ncin; 99 int off[2]; 100 int p[5]; 101 int rscore; 102 int table[6][6]; 103 int wscore; 104