#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main()
{
    int pid;

    pid = fork();
    if (pid == -1) {    /* error of child process */
        perror("fork");
        exit(1);
    }

    if (pid == 0) {     /* child process */
        execlp("ls", "ls", "-l", "-a", "/var", NULL);
        perror("ls");   /* error if exec returned here */
        exit(1);        /* end with error */
    }
    wait(NULL);         /* wait for child process, kill zombie */

    printf("Ok\n");
    return 0;
}
