예제 #1
0
void test_read(cbuf * thebuf)
{
    double shouldwe;
    int got, thislen;
    buf_t destbuf[BSIZE];
    FILE *fptr;

    fptr = stdout;
    shouldwe = rnum(1);
    if (shouldwe > 0.10)
	return;			/* only test 10% of the time */
    thislen = (int)rnum(BSIZE);
    got = read_cbuf(thebuf, destbuf, thislen);
    errlog2(5,"test_read asked: %d  got: %d\n",thislen, got);
    do_write(destbuf, got);
}
예제 #2
0
void		exec_client(t_client *client, t_chan **chans)
{
  t_message	msg;
  char		*str;

  client = first_node(&client->node);
  while (client != NULL)
    {
      while (is_cbuf_ready(&client->cbuf) == 0)
	{
	  if ((str = read_cbuf(&client->cbuf)) != NULL)
	    {
	      message(&msg, str);
	      if (msg.command != NULL)
		dprintf(1, "Recieved [%s] from [%s]\n",
			msg.command, client->nick);
	      exec_cmd(&msg, client, chans);
	      free(str);
	    }
	}
      client = client->node.next;
    }
}