#include <stdio.h>
#include <sys/types.h>
main()
{
int childid;
int parentid = getppid();
childid = fork();
if (childid == 0) /* this is the parent process */
{
printf("Created a child process\n");
}
else /* this is the child process */
{
//The child program immediately goes into an infinite loop
execl ("./child", "red", "white", "blue", NULL);
}
//Why is this thing skipped? Shouldn't it wait indefinately
//since the child is in an infinite loop?
waitpid(parentid);
printf("How did I get here?\n");
}