Exemplo n.º 1
0
main(){
	int fd1, fd2;

	exp_loguser = 1;
	exp_timeout = 3600;

	fd1 = exp_spawnl("chess","chess",(char *)0);

	if (-1 == exp_expectl(fd1,exp_glob,"Chess\r\n",0,exp_end)) exit;

	if (-1 == write(fd1,"first\r",6)) exit;

	read_first_move(fd1);

	fd2 = exp_spawnl("chess","chess",(char *)0);

	if (-1 == exp_expectl(fd2,exp_glob,"Chess\r\n",0,exp_end)) exit;

	for (;;) {
		send_move(fd2);
		read_counter_move(fd2);

		send_move(fd1);
		read_move(fd1);
	}
}
Exemplo n.º 2
0
void
prof_start(void)
{
    // helper script sets terminal columns, avoids assertions failing
    // based on the test runner terminal size
    fd = exp_spawnl("sh",
        "sh",
        "-c",
        "./tests/functionaltests/start_profanity.sh",
        NULL);
    FILE *fp = fdopen(fd, "r+");

    assert_true(fp != NULL);

    setbuf(fp, (char *)0);
}