fork.c

#include <stdio.h>

#include <unistd.h>

#include "utils.h"

int main(int argc, char *argv[])
{
    printf("---------------\n");
    int r;
    switch(r = fork()) {
        case -1: exit_if(1, "fork");
        case 0:
                 printf("Je suis le fils %d %d\n", getpid(), getppid());
                 break;
        default:
                 printf("Je suis ton père %d %d et tu es mon fils %d\n", getpid(), getppid(), r);
                 break;
    }
    return 0;
}