示例#1
0
void loadrc()
{
    FILE *resource = fopen(".bcerc", "r");

    if (resource)
    {
	char s[80], *p;

	while(fgets(s, 80, resource))
	{
	    if((p = strchr(s, '\n')) != NULL)
		*p = '\0';
	    
	    if (command_or_move(s))
		printf("unknown command in resource file: %s\n", s);
	}
    }
}
示例#2
0
文件: user.c 项目: cwbowron/pspchess
move usermove()
{
#if 0
    char str[80],*p;
    move m;
    
    memset(str, 0, sizeof(str[0]));
    
    fgets(str, sizeof(str), stdin);
    
    if((p = strchr(str, '\n')) != NULL)
    {
	*p = '\0';
    }
    
    if (xboard_mode)
    {
	printf("received - '%s'\n", str);
    }
    
    m = command_or_move(str);
    if (!m)
    {
	return 0;
    }
    else
    {
	switch(validmove(m))
	{
	    case 1:		/* valid move */
		return m;
	    case 0:
		printf("Error (unknown command - try 'help'): %s\n", str);
		return 0;
	    default:
		printf("Illegal move (cannot move into check)\n");
		return 0;
	}
    }
#endif
    return 0;
}