9 int main(int args
, char **argv
) {
15 fprintf(stderr
, "Need args\n");
21 fprintf(stderr
, "Could not fork\n");
23 } else if (pid
== 0) { /* child */
24 execvp(argv
[1], &argv
[1]);
25 /* should not be accessible */
28 waitpid(pid
, &status
, 0);
29 if (!WIFEXITED(status
)) {
30 if (WIFSIGNALED(status
))
32 "Process %d died of signal %d.\n",
33 pid
, WTERMSIG(status
));
34 /* did not exit correctly */
37 /* return the opposite */
38 return !WEXITSTATUS(status
);