$NetBSD: patch-ab,v 1.3 2005/12/19 17:29:35 joerg Exp $

--- src/gnuan.c.orig	Sat Apr  3 05:58:53 1999
+++ src/gnuan.c	Wed Nov 17 23:57:25 1999
@@ -67,6 +67,7 @@
 
 
 #include <ctype.h>
+#include <errno.h>
 #include <signal.h>
 #include <fcntl.h>
 #ifdef MSDOS
@@ -626,7 +627,6 @@ ElapsedTime (SHORT iop)
 
 #ifndef MSDOS
     int nchar;
-    extern int errno;
     int i;
 
 #ifdef FIONREAD
@@ -683,7 +683,6 @@ ElapsedTime (SHORT iop)
 {
 #ifndef MSDOS
     int nchar;
-    extern int errno;
     int i;
 
 #ifdef FIONREAD
@@ -1348,12 +1347,12 @@ InputCommand (void)
     fpout = stderr;
     fprintf (fpout, "Input the file with the algebraic moves of the game.\n");
     fflush (fpout);
-    gets (infilename);
+    fgets (infilename, 255, stdin); infilename[255] = '\0';
     fprintf (fpout, "\n");
     do
       {
 	  fprintf (fpout, "Input the search depth you want to use.  (1 to 29)(- for depth from file)\n");
-	  gets (inbuf);
+	  fgets (inbuf, 256, stdin); inbuf[255] = '\0';
 	  search_depth = atoi (inbuf);
 	  if (search_depth < 0)
 	    {
@@ -1369,7 +1368,7 @@ InputCommand (void)
     do
       {
 	  fprintf (fpout, "Input the maximum number of minutes per move you want to use.\n");
-	  gets (inbuf);
+	  fgets (inbuf, 256, stdin); inbuf[255] = '\0';
 	  max_minutes = atoi (inbuf);
 	  if (max_minutes < 0)
 	    {
@@ -1379,7 +1378,7 @@ InputCommand (void)
       }
     while ((max_minutes + max_seconds) < 1);
     fprintf (fpout, "Post the search results(y/n).\n");
-    gets (inbuf);
+    fgets (inbuf, 256, stdin); inbuf[255] = '\0';
     if (inbuf[0] == 'y')
 	flag.post = true;
     else
@@ -1559,7 +1558,8 @@ InputCommand (void)
 	      while (true)
 		{
 		    printf (">");
-		    gets (GNUANinbuf1);
+		    fgets (GNUANinbuf1, 128, stdin);
+		    GNUANinbuf1[127] = '\0';
 		    p = GNUANinbuf1;
 		    q = GNUANinbuf;
 		    while (true)
