[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] unknown_command
From: |
Paul Pogonyshev |
Subject: |
[gnugo-devel] unknown_command |
Date: |
Thu, 2 Jan 2003 22:21:04 +0200 |
i remember somebody posted a bug report about `known_command' gtp
command to the list. the bug was that `known_command' always printed
`false' in response, because it didn't remove newline character from
the query. it is still not fixed, so here is a patch for it (it also
skips all whitespace, as gtp requires).
i'm not sure what to respond to `known_command' alone, without a
command name. but since specification says that `known_command'
should never fail, i think the correct answer is `= false'.
Paul
Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.109
diff -u -p -r1.109 play_gtp.c
--- interface/play_gtp.c 1 Jan 2003 12:41:26 -0000 1.109
+++ interface/play_gtp.c 2 Jan 2003 20:12:53 -0000
@@ -3462,9 +3462,13 @@ static int
gtp_known_command(char *s)
{
int k;
- for (k = 0; commands[k].name != NULL; k++)
- if (strcmp(s, commands[k].name) == 0)
- return gtp_success("true");
+ char command[GTP_BUFSIZE];
+
+ if (sscanf(s, "%s", command) == 1) {
+ for (k = 0; commands[k].name != NULL; k++)
+ if (strcmp(command, commands[k].name) == 0)
+ return gtp_success("true");
+ }
return gtp_success("false");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] unknown_command,
Paul Pogonyshev <=