Subject: bin/6023: [PATCH] Adventure unused parameters
To: None <gnats-bugs@gnats.netbsd.org>
From: Joseph Myers <jsm@octomino.demon.co.uk>
List: netbsd-bugs
Date: 08/24/1998 18:18:24
>Number:         6023
>Category:       bin
>Synopsis:       [PATCH] Adventure unused parameters
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 24 11:20:00 1998
>Last-Modified:
>Originator:     Joseph Samuel Myers
>Organization:
Trinity College, University of Cambridge, UK
>Release:        NetBSD-current of 1998-08-19
>Environment:
[
System: Linux octomino 2.0.35 #1 Wed Aug 12 15:54:21 UTC 1998 i586 unknown
Architecture: i586
]
>Description:

The game adventure has several functions that do not use their
parameters, and from which the unused parameters can easily be removed
(i.e., no need to conform to a set prototype).  The patch below
removes these parameters from the definitions, prototypes and all
uses.

>How-To-Repeat:

>Fix:

diff -ruN adventure/extern.h adventure+/extern.h
--- adventure/extern.h	Sat Oct 11 11:49:19 1997
+++ adventure+/extern.h	Mon Aug 24 18:05:37 1998
@@ -39,7 +39,7 @@
 int die __P((int));
 
 /* init.c */
-void init __P((char *));
+void init __P((void));
 char   *decr __P((int, int, int, int, int));
 void linkdata __P((void));
 void trapdel __P((int));
@@ -82,11 +82,11 @@
 int here __P((int));
 int at  __P((int));
 int liq2 __P((int));
-int liq __P((int));
+int liq __P((void));
 int liqloc __P((int));
 int bitset __P((int, int));
 int forced __P((int));
-int dark __P((int));
+int dark __P((void));
 int pct __P((int));
 int fdwarf __P((void));
 int march __P((void));
@@ -124,7 +124,7 @@
 /* wizard.c */
 void datime __P((int *, int *));
 void poof __P((void));
-int Start __P((int));
+int Start __P((void));
 int wizard __P((void));
-void ciao __P((char *));
+void ciao __P((void));
 int ran __P((int));
diff -ruN adventure/init.c adventure+/init.c
--- adventure/init.c	Tue Feb  3 12:33:55 1998
+++ adventure+/init.c	Mon Aug 24 18:05:58 1998
@@ -66,8 +66,7 @@
 
 
 void
-init(command)			/* everything for 1st time run */
-	char   *command;	/* command we were called with */
+init()			/* everything for 1st time run */
 {
 	rdata();		/* read data from orig. file */
 	linkdata();
@@ -228,7 +227,7 @@
 void
 startup()
 {
-	demo = Start(0);
+	demo = Start();
 	srand((int) (time((time_t *) NULL)));	/* random seed */
 #if 0
 	srand(371);		/* non-random seed */
diff -ruN adventure/main.c adventure+/main.c
--- adventure/main.c	Sat Oct 11 11:49:23 1997
+++ adventure+/main.c	Mon Aug 24 18:08:41 1998
@@ -75,7 +75,7 @@
 	if (setuid(getuid()) < 0)
 		warn("setuid");
 
-	init(NULL);		/* Initialize everything */
+	init();		/* Initialize everything */
 	signal(SIGINT, trapdel);
 
 	if (argc > 1) {		/* Restore file specified */
@@ -83,7 +83,7 @@
 		i = restore(argv[1]);	/* See what we've got */
 		switch (i) {
 		case 0:	/* The restore worked fine */
-			yea = Start(0);
+			yea = Start();
 			k = null;
 			unlink(argv[1]);	/* Don't re-use the save */
 			goto l8;		/* Get where we're going */
@@ -113,7 +113,7 @@
 		kk = &stext[loc];
 		if ((abb[loc] % abbnum) == 0 || kk->seekadr == 0)
 			kk = &ltext[loc];
-		if (!forced(loc) && dark(0)) {
+		if (!forced(loc) && dark()) {
 			if (wzdark && pct(35)) {
 				die(90);
 				goto l2000;
@@ -131,7 +131,7 @@
 			goto l8;
 		if (loc == 33 && pct(25) && !closng)
 			rspeak(8);
-		if (!dark(0)) {
+		if (!dark()) {
 			abb[loc]++;
 			for (i = atloc[loc]; i != 0; i = links[i]) { /* 2004 */
 				obj = i;
@@ -170,7 +170,7 @@
 				if (toting(i) && prop[i] < 0)	/* 2604 */
 					prop[i] = -1 - prop[i];
 		}
-		wzdark = dark(0);	/* 2605 */
+		wzdark = dark();	/* 2605 */
 		if (knfloc > 0 && knfloc != loc)
 			knfloc = 1;
 		getin(&wd1, &wd2);
@@ -442,7 +442,7 @@
 				obj = obj * 100 + messag;
 			if (closed && toting(oyster))
 				obj = oyster;
-			if (obj > 100 || obj == 0 || dark(0))
+			if (obj > 100 || obj == 0 || dark())
 				goto l8000;
 			goto l9270;
 		case 30:	/* suspend=8300 */
@@ -456,7 +456,7 @@
 			if (!yes(200, 54, 54))
 				goto l2012;
 			datime(&saved, &savet);
-			ciao(argv[0]);	/* Do we quit? */
+			ciao();	/* Do we quit? */
 			continue;	/* Maybe not */
 		case 31:	/* hours=8310 */
 			printf("Colossal cave is closed 9am-5pm Mon ");
@@ -533,7 +533,7 @@
 				goto l2011;
 			prop[lamp] = 0;
 			rspeak(40);
-			if (dark(0))
+			if (dark())
 				rspeak(16);
 			goto l2012;
 
@@ -571,7 +571,7 @@
 			}
 		l9130: case 13:/* pour */
 			if (obj == bottle || obj == 0)
-				obj = liq(0);
+				obj = liq();
 			if (obj == 0)
 				goto l8000;
 			if (!toting(obj))
@@ -608,12 +608,12 @@
 				spk = 71;
 			goto l2011;
 		l9150: case 15:/* 9150 - drink */
-			if (obj == 0 && liqloc(loc) != water && (liq(0) != water
+			if (obj == 0 && liqloc(loc) != water && (liq() != water
 				|| !here(bottle)))
 				goto l8000;
 			if (obj != 0 && obj != water)
 				spk = 110;
-			if (spk == 110 || liq(0) != water || !here(bottle))
+			if (spk == 110 || liq() != water || !here(bottle))
 				goto l2011;
 			prop[bottle] = 1;
 			place[water] = 0;
@@ -640,7 +640,7 @@
 			}
 		case 19:
 		case 20:	/* 9190: find, invent */
-			if (at(obj) || (liq(0) == obj && at(bottle))
+			if (at(obj) || (liq() == obj && at(bottle))
 			    || k == liqloc(loc))
 				spk = 94;
 			for (i = 1; i <= 5; i++)
@@ -680,7 +680,7 @@
 			rspeak(bonus);
 			done(2);
 		l9270: case 27:/* read */
-			if (dark(0))
+			if (dark())
 				goto l5190;
 			if (obj == magzin)
 				spk = 190;
@@ -749,7 +749,7 @@
 		for (i = 1; i <= 5; i++)
 			if (dloc[i] == loc && dflag >= 2)
 				goto l5010;
-l5120:		if ((liq(0) == k && here(bottle)) || k == liqloc(loc))
+l5120:		if ((liq() == k && here(bottle)) || k == liqloc(loc))
 			goto l5010;
 		if (obj != plant || !at(plant2) || prop[plant2] == 0)
 			goto l5130;
diff -ruN adventure/subr.c adventure+/subr.c
--- adventure/subr.c	Sat Oct 11 11:49:26 1997
+++ adventure+/subr.c	Mon Aug 24 18:11:36 1998
@@ -92,7 +92,7 @@
 }
 
 int
-liq(foo)
+liq()
 {
 	int     i;
 	i = prop[bottle];
@@ -133,7 +133,7 @@
 }
 
 int
-dark(foo)
+dark()
 {
 	if ((cond[loc] % 2) == 0 && (prop[lamp] == 0 || !here(lamp)))
 		return (TRUE);
@@ -588,7 +588,7 @@
 	if (fixed[obj] != 0)
 		return (2011);
 	if (obj == water || obj == oil) {
-		if (here(bottle) && liq(0) == obj) {
+		if (here(bottle) && liq() == obj) {
 			obj = bottle;
 			goto l9017;
 		}
@@ -621,7 +621,7 @@
 l9014:	if ((obj == bird || obj == cage) && prop[bird] != 0)
 		carry(bird + cage - obj, loc);
 	carry(obj, loc);
-	k = liq(0);
+	k = liq();
 	if (obj == bottle && k != 0)
 		place[k] = -1;
 	return (2009);
@@ -631,7 +631,7 @@
 int
 dropper()
 {				/* 9021                 */
-	k = liq(0);
+	k = liq();
 	if (k == obj)
 		obj = bottle;
 	if (obj == bottle && k != 0)
@@ -987,12 +987,12 @@
 	spk = 107;
 	if (liqloc(loc) == 0)
 		spk = 106;
-	if (liq(0) != 0)
+	if (liq() != 0)
 		spk = 105;
 	if (spk != 107)
 		return (2011);
 	prop[bottle] = ((cond[loc] % 4) / 2) * 2;
-	k = liq(0);
+	k = liq();
 	if (toting(bottle))
 		place[k] = -1;
 	if (k == oil)
diff -ruN adventure/wizard.c adventure+/wizard.c
--- adventure/wizard.c	Sat Jul 25 11:06:19 1998
+++ adventure+/wizard.c	Mon Aug 24 18:11:59 1998
@@ -86,7 +86,7 @@
 }
 
 int
-Start(n)
+Start()
 {
 	int     d, t, delay;
 
@@ -130,8 +130,7 @@
 }
 
 void
-ciao(cmdfile)
-	char   *cmdfile;
+ciao()
 {
 	char   *c;
 	char    fname[80];
>Audit-Trail:
>Unformatted: