#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
#include "utils.h"
int main(int argc, char *argv[])
{
int status;
pid_t pid;
switch(pid = fork()) {
case -1: exit_if(1, "Can't fork");
case 0:
printf("I'm the child %d, of %d\n", getpid(), getppid());
return 42;
default:
printf("I'm the father of %d\n", pid);
wait(&status);
printf("with status %d\n", WEXITSTATUS(status));
break;
}
return 0;
}