#include #include #include const int fdstdin = 0, fdstdout = 1; void main() { int oldstate = fcntl(fdstdin, F_GETFL, 0); fcntl(fdstdin, F_SETFL, oldstate | O_NONBLOCK); while (1) { char line[1000]; int n = read(fdstdin, line, 999); if (n>0) write(fdstdout, line, n); else { write(fdstdout, ".", 1); usleep(500000); } } fcntl(fdstdin, F_SETFL, oldstate); }