#include "process.h" #include "headers.h" #define BUFSIZE 1024 void *process_fd(void *arg){ int nbytes, fd = *((int *)(arg)); char buf[BUFSIZE]; while(1){ if(((nbytes = read(fd, buf, BUFSIZE)) == -1) && (errno != EINTR)) break; if(!nbytes) break; process_command(buf, nbytes); } return NULL; } void process_command(char *buffy, int bytes){ if(write(STDOUT_FILENO, buffy, bytes) < bytes) fprintf(stderr, "write of buffy failed"); } void *pr_msg_fn(void *arg){ fprintf(stderr, "%s ", (char *)arg); return NULL; }