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

The game adventure contains one completely unused function, confirm().
In addition, the header extern.h contains a spurious prototype from
setup.c (which is not linked into the executable), and an incorrect
prototype for twrite(), which is only compiled if DEBUG is defined.

The appended patch removes the unused function, its prototype, and
that from setup.c (a correct main() prototype is also correctly given
under the main.c heading), and corrects and makes conditional that of
twrite().

>How-To-Repeat:

>Fix:

diff -ruN adventure/extern.h adventure+2/extern.h
--- adventure/extern.h	Tue Aug 25 11:05:16 1998
+++ adventure+2/extern.h	Wed Aug 26 20:31:12 1998
@@ -49,7 +49,6 @@
 
 /* io.c */
 void getin __P((char **, char **));
-int confirm __P((char *));
 int yes __P((int, int, int));
 int yesm __P((int, int, int));
 int next __P((void));
@@ -57,7 +56,9 @@
 int rnum __P((void));
 void rdesc __P((int));
 void rtrav __P((void));
-int twrite __P((int));
+#ifdef DEBUG
+void twrite __P((int));
+#endif
 void rvoc __P((void));
 void rlocs __P((void));
 void rdflt __P((void));
@@ -75,9 +76,6 @@
 /* save.c */
 int save __P((char *));
 int restore __P((char *));
-
-/* setup.c */
-int main __P((int, char *[]));
 
 /* subr.c */
 int toting __P((int));
diff -ruN adventure/io.c adventure+2/io.c
--- adventure/io.c	Sat Oct 11 11:49:22 1997
+++ adventure+2/io.c	Wed Aug 26 20:31:42 1998
@@ -101,20 +101,6 @@
 }
 
 int
-confirm(mesg)			/* confirm irreversible action  */
-	char   *mesg;
-{
-	int     result;
-	printf("%s", mesg);	/* tell him what he did         */
-	if (getchar() == 'y')	/* was his first letter a 'y'?  */
-		result = 1;
-	else
-		result = 0;
-	FLUSHLINE;
-	return (result);
-}
-
-int
 yes(x, y, z)			/* confirm with rspeak          */
 	int     x, y, z;
 {
>Audit-Trail:
>Unformatted: