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

int main() {
    int pid;
    pid = fork();
    
    if (pid < 0) {
        printf("\nFORK FAILED\n");
        exit(-1);
    }
    else if (pid == 0) {
        // Use execvp to run the "ls" command
        execlp("ls", "ls", "-l", NULL); // Fixed the function and arguments
    }
    else {
        wait(NULL); // Wait for child to finish
    }

    printf("\nCHILD COMPLETE\n");
    exit(0);
}
