gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] trevor_1_10.2


From: Trevor Morris
Subject: [gnugo-devel] trevor_1_10.2
Date: Tue, 09 Oct 2001 10:39:30 -0400

Here's a patch that corrects the cygwin problem w/ dragon-data,
and a couple of related problems.

Relatedly, the following problem still exists under cygwin.
Seems to be a problem with sscanf and %n under cygwin in
gtp_main_loop in gtp.c, but I've still not nailed it down.

loadsgf
? cannot open or parse 'äûÿƒÄ?%ökƒ0?.'

loadsgf x
? cannot open or parse 'x'

loadsgf
? missing filename

Notice how the (correct) missing filename error message comes up 
only after calling loadsgf with an invalid file.

-Trevor



http://www.public32.com/games/go/trevor_1_10.2

Index: play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.21
diff -w -u -r1.21 play_gtp.c
--- play_gtp.c  2001/10/06 20:00:51     1.21
+++ play_gtp.c  2001/10/09 14:31:06
@@ -471,7 +471,7 @@
   int nread;
   
   nread = sscanf(s, "%s %s", filename, untilstring);
-  if (nread == 0)
+  if (nread < 1)
     return gtp_failure(id, "missing filename");
   
   if ((sgf = readsgffile(filename)) == NULL)
@@ -1979,7 +1979,7 @@
   int j = -1;
   int m, n;
 
-  if (sscanf(s, " %*c") >= 0 && !gtp_decode_coord(s, &i, &j))
+  if (sscanf(s, " %*c") >= 1 && !gtp_decode_coord(s, &i, &j))
     return gtp_failure(id, "invalid color or coordinate");
 
   examine_position(EMPTY, EXAMINE_WORMS);
@@ -2033,7 +2033,7 @@
   int m, n;
   int u, v;
 
-  if (sscanf(s, " %*c") >= 0) {
+  if (sscanf(s, " %*c") >= 1) {
     if (!gtp_decode_coord(s, &i, &j)
        && !gtp_decode_color(s, &color))
       return gtp_failure(id, "invalid coordinate");
@@ -2101,7 +2101,7 @@
   int j = -1;
   int m, n;
 
-  if (sscanf(s, " %*c") >= 0 && !gtp_decode_coord(s, &i, &j))
+  if (sscanf(s, " %*c") >= 1 && !gtp_decode_coord(s, &i, &j))
     return gtp_failure(id, "invalid coordinate");
 
   if (stackp > 0)
@@ -2206,7 +2206,7 @@
   int m, n;
   int u, v;
 
-  if (sscanf(s, " %*c") >= 0 && !gtp_decode_coord(s, &i, &j))
+  if (sscanf(s, " %*c") >= 1 && !gtp_decode_coord(s, &i, &j))
     return gtp_failure(id, "invalid coordinate");
 
   if (BOARD(i, j) == EMPTY)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]