/* a sample program that illustate the fuction wait(). */
#include <stdlib.h>
#include <sys/wait.h>

int main() {
    int pid;
    int stat;

    pid = fork();
    if(pid == 0) {
        printf(" This is child process, please wait\n");
        sleep(5);
    }
    else {
        wait(&stat);  /* wait the child process exit */
        printf(" The child process exit\n");
    }
}
