1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

Drop the argument passing between backgammon and teachgammon.

It's broken.  Instead, make -d imply -n.  You're supposed to
know the rules before you start tweaking them.

Issue reported by and ok pjanzen@
Patient help with the manual jmc@
This commit is contained in:
tb 2015-12-02 20:05:01 +00:00
parent 68dfd3dc2e
commit 091d139da5
6 changed files with 19 additions and 27 deletions

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: backgammon.6,v 1.20 2014/04/25 20:33:05 schwarze Exp $
.\" $OpenBSD: backgammon.6,v 1.21 2015/12/02 20:05:01 tb Exp $
.\"
.\" Copyright (c) 1980, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)backgammon.6 8.1 (Berkeley) 5/31/93
.\"
.Dd $Mdocdate: April 25 2014 $
.Dd $Mdocdate: December 2 2015 $
.Dt BACKGAMMON 6
.Os
.Sh NAME
@ -60,26 +60,26 @@ obtained by answering
.Sq y
when it asks if you want instructions.
.Pp
The possible arguments for backgammon
(most are unnecessary but some are very convenient)
consist of:
The possible arguments for
.Nm
are described below.
In each case
.Fl n
is implied.
.Bl -tag -width indent
.It Fl b
Two players, red and white (implies
.Fl n ) .
Two players, red and white.
.It Fl d
Play without doubling.
.It Fl n
Don't ask for rules or instructions.
.It Fl r
Player is red (implies
.Fl n ) .
Player is red.
.It Fl s Ar file
Recover previously saved game from
.Ar file .
.It Fl w
Player is white (implies
.Fl n ) .
Player is white.
.El
.Sh QUICK REFERENCE
When the program prompts by typing only your color,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.21 2015/12/01 07:43:30 tb Exp $ */
/* $OpenBSD: main.c,v 1.22 2015/12/02 20:05:01 tb Exp $ */
/*
* Copyright (c) 1980, 1993
@ -103,7 +103,6 @@ main (int argc, char **argv)
begscr = 0;
getarg(argc, argv);
args[acnt] = '\0';
initcurses();
@ -123,7 +122,7 @@ main (int argc, char **argv)
addstr(rules);
if (yorn(0)) {
endwin();
execl(TEACH, "teachgammon", args, (char *)NULL);
execl(TEACH, "teachgammon", (char *)NULL);
err(1, "%s", noteach);
} else {/* if not rules, then instructions */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: back.h,v 1.13 2014/04/25 20:23:37 schwarze Exp $ */
/* $OpenBSD: back.h,v 1.14 2015/12/02 20:05:01 tb Exp $ */
/*
* Copyright (c) 1980, 1993
@ -75,8 +75,6 @@ extern int pnum; /* color of player:
1 = red
0 = both
2 = not yet init'ed */
extern char args[100]; /* args passed to teachgammon and back */
extern int acnt; /* length of args */
extern int aflag; /* flag to ask for rules or instructions */
extern int cflag; /* case conversion flag */
extern int hflag; /* flag for cleaning screen */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: init.c,v 1.10 2009/10/27 23:59:23 deraadt Exp $ */
/* $OpenBSD: init.c,v 1.11 2015/12/02 20:05:01 tb Exp $ */
/*
* Copyright (c) 1980, 1993
@ -48,7 +48,6 @@ int pnum = 2; /* color of player:
1 = red
0 = both
2 = not yet init'ed */
int acnt = 0; /* length of args */
int aflag = 1; /* flag to ask for rules or instructions */
int cflag = 0; /* case conversion flag */
int hflag = 1; /* flag for cleaning screen */
@ -68,7 +67,6 @@ int *inopp;
int *inptr;
int *offopp;
int *offptr;
char args[100];
int bar;
int begscr;
int board[26];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: subs.c,v 1.21 2015/11/30 08:19:25 tb Exp $ */
/* $OpenBSD: subs.c,v 1.22 2015/12/02 20:05:01 tb Exp $ */
/*
* Copyright (c) 1980, 1993
@ -197,7 +197,6 @@ getarg(int argc, char **argv)
if (rflag)
break;
aflag = 0;
args[acnt++] = 'n';
break;
case 'b': /* player is both red and white */
@ -205,7 +204,6 @@ getarg(int argc, char **argv)
break;
pnum = 0;
aflag = 0;
args[acnt++] = 'b';
break;
case 'r': /* player is red */
@ -213,7 +211,6 @@ getarg(int argc, char **argv)
break;
pnum = -1;
aflag = 0;
args[acnt++] = 'r';
break;
case 'w': /* player is white */
@ -221,7 +218,6 @@ getarg(int argc, char **argv)
break;
pnum = 1;
aflag = 0;
args[acnt++] = 'w';
break;
case 's': /* restore saved game */
@ -230,6 +226,7 @@ getarg(int argc, char **argv)
case 'd': /* disable doubling */
dflag = 0;
aflag = 0;
break;
default: /* print cmdline options */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: teach.c,v 1.15 2015/11/30 08:19:25 tb Exp $ */
/* $OpenBSD: teach.c,v 1.16 2015/12/02 20:05:01 tb Exp $ */
/*
* Copyright (c) 1980, 1993
@ -118,6 +118,6 @@ leave(void)
{
clear();
endwin();
execl(EXEC, "backgammon", "-n", args, (char *)NULL);
execl(EXEC, "backgammon", "-n", (char *)NULL);
errx(1, "help! Backgammon program is missing!!");
}