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); } }
/** * 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; }
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; }