/*
 * forkAndSleep.c -- study output of pstree
 */


#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>

void child1() {
  pid_t childPid;

  if ((childPid = fork()) == -1) {
    perror("forking error");
    exit(EXIT_FAILURE);
  }

  sleep(100); /* both sleep */
}


int main() {
  pid_t childPid;

  if ((childPid = fork()) == -1) {
    perror("forking error");
    exit(EXIT_FAILURE);
  }

  if (childPid == 0) {
    child1();
  } else {
    sleep(100); /* parent sleeps */
  }
}
