I am trying to simulate the cat function.
Here is a start:
ssize_t nread, nwrite;
while ((nread = read(STDIN_FILENO, buf, sizeof buf)) > 0) {
nwrite = write(STDOUT_FILENO, buf, nread);
/* Error handling and partial writes left as exercise. */
}