summaryrefslogtreecommitdiffstats
path: root/backgammon/backgammon
diff options
context:
space:
mode:
authorhubertf <hubertf@NetBSD.org>1999-02-10 12:29:47 +0000
committerhubertf <hubertf@NetBSD.org>1999-02-10 12:29:47 +0000
commitf2e552ba9ea473d3399e7b124077a7e4a856138b (patch)
treece3f13ceac941baa50c07a090d8cbd73be7fda90 /backgammon/backgammon
parent19bd733c3aad11dcfb4bbcf06abf79ff64442032 (diff)
downloadbsdgames-darwin-f2e552ba9ea473d3399e7b124077a7e4a856138b.tar.gz
bsdgames-darwin-f2e552ba9ea473d3399e7b124077a7e4a856138b.tar.zst
bsdgames-darwin-f2e552ba9ea473d3399e7b124077a7e4a856138b.zip
The patch below makes the game backgammon(6) use `const' where
appropriate. It also removes some obsolete, unused code to check the number of users on the system (obsoleted by dm); removes a prototype for an unused function that was removed earlier; and removes a control character from one message that was I think intended to clear the screen on some particular terminal (though I can't find the comment to that effect in any of the BSD source trees I have handy) but no longer serves any useful purpose. From PR 6580 by Joseph Myers <jsm28@cam.ac.uk>. Also contains two more patches, one in teachgammon/tutor.h (by Joseph) and one in common_source/fancy.c (by me).
Diffstat (limited to 'backgammon/backgammon')
-rw-r--r--backgammon/backgammon/main.c80
-rw-r--r--backgammon/backgammon/text.c10
-rw-r--r--backgammon/backgammon/version.c6
3 files changed, 32 insertions, 64 deletions
diff --git a/backgammon/backgammon/main.c b/backgammon/backgammon/main.c
index e019c8df..0a4ff8a2 100644
--- a/backgammon/backgammon/main.c
+++ b/backgammon/backgammon/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.8 1998/09/15 13:43:34 frueauf Exp $ */
+/* $NetBSD: main.c,v 1.9 1999/02/10 12:29:47 hubertf Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: main.c,v 1.8 1998/09/15 13:43:34 frueauf Exp $");
+__RCSID("$NetBSD: main.c,v 1.9 1999/02/10 12:29:47 hubertf Exp $");
#endif
#endif /* not lint */
@@ -51,53 +51,42 @@ __RCSID("$NetBSD: main.c,v 1.8 1998/09/15 13:43:34 frueauf Exp $");
#include "backlocal.h"
#define MVPAUSE 5 /* time to sleep when stuck */
-#define MAXUSERS 35 /* maximum number of users */
-extern char *instr[]; /* text of instructions */
-extern char *message[]; /* update message */
+extern const char *const instr[]; /* text of instructions */
+extern const char *const message[]; /* update message */
speed_t ospeed; /* tty output speed */
-char *helpm[] = { /* help message */
+const char *const helpm[] = { /* help message */
"Enter a space or newline to roll, or",
" R to reprint the board\tD to double",
" S to save the game\tQ to quit",
0
};
-char *contin[] = { /* pause message */
+const char *const contin[] = { /* pause message */
"(Type a newline to continue.)",
"",
0
};
-#if 0
-static char user1a[] =
-"Sorry, you cannot play backgammon when there are more than ";
-static char user1b[] =
-" users\non the system.";
-static char user2a[] =
-"\nThere are now more than ";
-static char user2b[] =
-" users on the system, so you cannot play\nanother game. ";
-#endif
-static char rules[] = "\nDo you want the rules of the game?";
-static char noteach[] = "Teachgammon not available!\n\007";
-static char need[] = "Do you need instructions for this program?";
-static char askcol[] =
+static const char rules[] = "\nDo you want the rules of the game?";
+static const char noteach[] = "Teachgammon not available!\n\007";
+static const char need[] = "Do you need instructions for this program?";
+static const char askcol[] =
"Enter 'r' to play red, 'w' to play white, 'b' to play both:";
-static char rollr[] = "Red rolls a ";
-static char rollw[] = ". White rolls a ";
-static char rstart[] = ". Red starts.\n";
-static char wstart[] = ". White starts.\n";
-static char toobad1[] = "Too bad, ";
-static char unable[] = " is unable to use that roll.\n";
-static char toobad2[] = ". Too bad, ";
-static char cantmv[] = " can't move.\n";
-static char bgammon[] = "Backgammon! ";
-static char gammon[] = "Gammon! ";
-static char again[] = ".\nWould you like to play again?";
-static char svpromt[] = "Would you like to save this game?";
-
-static char password[] = "losfurng";
+static const char rollr[] = "Red rolls a ";
+static const char rollw[] = ". White rolls a ";
+static const char rstart[] = ". Red starts.\n";
+static const char wstart[] = ". White starts.\n";
+static const char toobad1[] = "Too bad, ";
+static const char unable[] = " is unable to use that roll.\n";
+static const char toobad2[] = ". Too bad, ";
+static const char cantmv[] = " can't move.\n";
+static const char bgammon[] = "Backgammon! ";
+static const char gammon[] = "Gammon! ";
+static const char again[] = ".\nWould you like to play again?";
+static const char svpromt[] = "Would you like to save this game?";
+
+static const char password[] = "losfurng";
static char pbuf[10];
int
@@ -121,16 +110,6 @@ main(argc, argv)
raw.c_lflag &= ~ICANON; /* set up modes */
ospeed = cfgetospeed(&old); /* for termlib */
- /* check user count */
-#ifdef CORY
- if (ucount() > MAXUSERS) {
- writel(user1a);
- wrint(MAXUSERS);
- writel(user1b);
- getout(0);
- }
-#endif
-
/* get terminal capabilities, and decide if it can cursor address */
tflag = getcaps(getenv("TERM"));
/* use whole screen for text */
@@ -519,17 +498,6 @@ main(argc, argv)
/* write score */
wrscore();
- /* check user count */
-#ifdef CORY
- if (ucount() > MAXUSERS) {
- writel(user2a);
- wrint(MAXUSERS);
- writel(user2b);
- rfl = 1;
- break;
- }
-#endif
-
/* see if he wants another game */
writel(again);
if ((i = yorn('S')) == 0)
diff --git a/backgammon/backgammon/text.c b/backgammon/backgammon/text.c
index b6685a42..27b9bb1b 100644
--- a/backgammon/backgammon/text.c
+++ b/backgammon/backgammon/text.c
@@ -1,4 +1,4 @@
-/* $NetBSD: text.c,v 1.5 1997/10/10 08:59:38 lukem Exp $ */
+/* $NetBSD: text.c,v 1.6 1999/02/10 12:29:47 hubertf Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,13 +38,13 @@
#if 0
static char sccsid[] = "@(#)text.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: text.c,v 1.5 1997/10/10 08:59:38 lukem Exp $");
+__RCSID("$NetBSD: text.c,v 1.6 1999/02/10 12:29:47 hubertf Exp $");
#endif
#endif /* not lint */
#include "back.h"
-char *instr[] = {
+const char *const instr[] = {
" If you did not notice by now, this program reacts to things as",
"soon as you type them, without waiting for a newline. This means that",
"the special characters RUBOUT, ESC, and CONTROL-D, will not perform",
@@ -112,10 +112,10 @@ char *instr[] = {
int
text(t)
- char **t;
+ const char *const *t;
{
int i;
- char *s, *a;
+ const char *s, *a;
fixtty(&noech);
while (*t != 0) {
diff --git a/backgammon/backgammon/version.c b/backgammon/backgammon/version.c
index 23ebb2e6..676ecbc0 100644
--- a/backgammon/backgammon/version.c
+++ b/backgammon/backgammon/version.c
@@ -1,4 +1,4 @@
-/* $NetBSD: version.c,v 1.4 1997/10/10 08:59:39 lukem Exp $ */
+/* $NetBSD: version.c,v 1.5 1999/02/10 12:29:47 hubertf Exp $ */
/*
* Copyright (c) 1980, 1987, 1993
@@ -38,11 +38,11 @@
#if 0
static char sccsid[] = "@(#)version.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: version.c,v 1.4 1997/10/10 08:59:39 lukem Exp $");
+__RCSID("$NetBSD: version.c,v 1.5 1999/02/10 12:29:47 hubertf Exp $");
#endif
#endif /* not lint */
-char *message[] = {
+const char *const message[] = {
"Last updated on Friday, October 10, 1997.",
0
};