#include int main() { int also_stdin = dup(0); int also_stdout = dup(1); int bread; char buf[128]; close (0); close (1); // echo stdin to stdout; while ((bread = read(also_stdin, buf, sizeof buf)) > 0) { write(also_stdout, buf, bread); } }