blob: dc3281930237e593d8eff0ea764481ebb1846c38 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include <unistd.h> // fork, execl
#include <sys/wait.h> // wait
#include <sys/types.h> // pid_t
#include <stdio.h> // printf
int main(int argc, char* argv[]) {
pid_t f = fork();
if (f == 0) { // in child
execl(argv[1], argv[1], (char*)NULL);
}
else {
int status;
wait(&status);
printf("Exit status: %d\n", status);
}
}
|