/* child.c - In an infinite loop, it reads characters from standard input
 *           and writes them to standard output until it finds an end of file.
 */


#include <stdio.h>
#include <errno.h>

extern int errno;

int
main(int argc, char *argv[])
{
  int c;

  for ( ; ; ) {
    c = getchar();
    if (c != EOF) {
      putchar(c);
      if (c == '\n') 
	fflush(stdout);
    } else { 
      /* We check to make sure that getchar did not fail because
	 of an intervening signal */
      if (errno == EINTR) {
	printf("Signal while the child was reading\n");
	continue;
      }
      break;
    }
  }
  return 0;
}
