#include <stdbool.h>      // for bool
#include <stdio.h>        // for printf
#include <unistd.h>       // for fork, getpid, getppid
#include "exit-utils.h"   // for our own exitIf
#include <assert.h>

static const int kForkFailed = 1;
int main(int argc, char *argv[])
{
  pid_t pid = fork();
  exitIf(pid == -1, kForkFailed, stderr, "fork function failed.\n");
  
  if (pid == 0) { // in child (assumes no errors)
  	int i;
  	for (i = 0; i < 30; i++) {
  		printf("child: i=%d\n", i);
  		sleep(1);
  	}
  } else {
  	printf("parent\n");
  }

     
  
  return 0;
}

