Animal
public c v1 · immutableint nfds;fd_set readfds;char buf;while(1) {FD_ZERO(&readfds);FD_SET(outfd, &readfds);FD_SET(stdin, &readfds);// nfds = MAX(outfd, stdin) + 1nfds = outfd + 1;select(nfds, &readfds, NULL, NULL, NULL);if(FD_ISSET(stdin, &readfds)) { read(stdin, &buf, 1); write(infd, &buf, 1, 0);}if(FD_ISSET(outfd, &readfds)) { read(outfd, &buf, 1); write(infd, &buf, 1, 0);}} // while