コード例 #1
0
ファイル: get_client.c プロジェクト: canercandan/another-ftp
void	get_client(t_ftp *f)
{
  t_cmd	c;
  char	buf[1024];
  int	nbr;
  int	pid;

  if (DEBUG)
    printf("get_client()\n");
  if (!(pid = fork()))
    {
      f->cnt = FALSE;
      bzero(buf, sizeof(buf));
      mesg_start(f);
      while ((nbr = (int) xrecv(f->cs, buf, (void *) sizeof(buf), 0)) > 0)
	{
	  if (cmd_init(&c, f, trim(buf)) == TRUE)
	    if (req_init(&c) == RET_QUIT)
	      break;
	  bzero(buf, sizeof(buf));
	}
      close(f->cs);
      exit(0);
    }
}
コード例 #2
0
ファイル: sss4910.c プロジェクト: SSS4910/CudaP
/**
 * FUNCTION: buffer_init
 * -----------------------
 * initialize buffer to store each line of the log
 *
 * @return a pointer to a buffer structure on success, NULL on failure
 */
int 
buffer_init(Buffer * buffer){
    int i;
    buffer->requests = malloc((BUFFER_SIZE) * sizeof(Request));
    for (i = 0; i < BUFFER_SIZE; i++)
    {
        if (req_init(&buffer->requests[i]))
        {
            debug_write("request struct allocation error!\n");
            return 1;
        }
    }
    return 0;
}
コード例 #3
0
ファイル: main.c プロジェクト: manuel-io/petridish
void
main()
{
  char *hello = "Hello ";
  char *world = (char *)0x4000000;
  mode();
  req_init();
  time_init();
  vga_init();
  kmi_init();
  uart_puts(hello);
  uart_puts(world);
  sti();
  syscall(65);
  mode();
  return;
}