gochatai/pachi_py/pachi/gtp.c
/* Return true if cmd is a valid gtp command. */
Return true if cmd is a valid gtp command.
Return true if cmd is a valid gtp command .
bool
gtp_is_valid(struct engine *e, const char *cmd)
{
	if (!cmd || !*cmd) return false;
	const char *s = strcasestr(known_commands(e), cmd);
	if (!s) return false;
	if (s != known_commands(e) && s[-1] != '\n') return false;
	int len = strlen(cmd);
	return s[len] == '\0' || s[len] == '\n';
}
bool gtp_is_valid ( struct engine * e , const char * cmd ) { if ( ! cmd || ! * cmd ) return false ; const char * s = strcasestr ( known_commands ( e ) , cmd ) ; if ( ! s ) return false ; if ( s != known_commands ( e ) && s [ -1 ] != ' \n ' ) return false ; int len = strlen ( cmd ) ; return s [ len ] == ' \0 ' || s [ len ] == ' \n ' ; }
Return true if cmd is a valid gtp command.
Return true if cmd is a valid gtp command .