only bring in as many sdl things as are strictly necessary
[tangerine.git] / tools / collect-aros / docommand-exec.c
blob5bcd9cd5b3358cc2c7b132a33974cf5408c10ee9
1 #include <unistd.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <errno.h>
5 #include <sys/wait.h>
6 #include <fcntl.h>
7 #include <sys/param.h>
9 #include "docommand.h"
10 #include "misc.h"
12 static void _docommandv(const char *command, char *argv[], int do_path)
14 pid_t pid = vfork();
15 int status;
17 if (pid == -1)
18 fatal("vfork()", strerror(errno));
20 if (pid == 0)
22 (do_path ? execvp : execv)(command, argv);
24 nonfatal(command, strerror(errno));
26 _exit(EXIT_FAILURE);
29 waitpid(pid, &status, 0);
30 if (WEXITSTATUS(status) != 0)
31 exit(EXIT_FAILURE);
34 void docommandv(const char *command, char *argv[])
36 _docommandv(command, argv, 0);
39 void docommandvp(const char *command, char *argv[])
41 set_compiler_path();
42 _docommandv(command, argv, 1);