execlp.c
/**
* execlp.c
*
* Demonstration of execlp(3). While execvp(3) supports executing an array of
* command line arguments, execlp takes a list of arguments directly while still
* searching the path (unlike the execl(3) call we saw in our first fork.c
* example).
*
* Compile: gcc -g -Wall execlp.c -o execlp
* Run: ./execlp
*/
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
/* Runs 'ls -l -a': */
execlp("ls", "ls", "-l", "-a", NULL);
return 0;
}