#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/wait.h>
int main(int argc, char *argv[])
{
	pid_t p;
	int status;
	p = fork();
	assert( p >= 0);

	if ( p == 0){
		printf("@retour de fork = %d pid = %d ppid = %d\n",p,getpid(),getppid());
		sleep(4);
		exit(2);
	}

	printf("@retour de fork = %d pid = %d ppid = %d\n",p,getpid(),getppid());

	assert( wait(&status) >= 0);

	if (WIFEXITED(status))
	printf("code retour fils = %d\n",WEXITSTATUS(status));

	execlp("ls","totototo","-l","/",NULL);
	
	/* code ici */
	assert(0);

	return 0;
}
