Files
wait/wait.c
Marcel Nijenhof 5d81752633
All checks were successful
continuous-integration/drone/push Build is passing
Optie voor starten programma's ingebouwd
2021-12-12 22:27:52 +01:00

27 lines
392 B
C

#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
pid_t execprog(char *argv[]) {
pid_t res;
res = fork();
if (res == 0) {
execvp(argv[1], &argv[1]);
}
return(res);
}
int main(int argc, char *argv[]) {
pid_t res;
int status;
if (argc > 1) {
execprog(argv);
}
while (1) {
res = wait(&status);
sleep(1);
}
return(0);
}