main() /* cat command; Kernighan, Ritchie, p. 180 */ { copyfile(0,1); } #define BLOCK 512 copyfile(fd1,fd2) int fd1, fd2; { char buffer[BLOCK]; int n; while ((n = read(fd1, buffer, BLOCK)) > 0) write(fd2, buffer, n); }