#include #include void runStdio() { char inBuff[ 200 ]; char *tmpPtr; for (;;) { tmpPtr = fgets (inBuff, 200, stdin ); if (tmpPtr) printf ("string: %s", tmpPtr); else exit (1); } } void runSleep() { int timeLeft; for (;;) { timeLeft = sleep(40); printf( "time left == %d\n", timeLeft); } } void runStub() { } void runStubIo() { printf ("runStubIo(): called\n"); } main() { int cpid; #ifdef USE_FORK cpid = fork (); if (cpid) runSleep (); else runStdio (); #else runSleep (); #endif }