projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add some gcc hint defines
[mmh]
/
sbr
/
execprog.c
diff --git
a/sbr/execprog.c
b/sbr/execprog.c
index
6a4a912
..
c10421d
100644
(file)
--- a/
sbr/execprog.c
+++ b/
sbr/execprog.c
@@
-4,6
+4,9
@@
*/
#include <h/mh.h>
*/
#include <h/mh.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <sysexits.h>
int
int
@@
-11,28
+14,26
@@
execprog(char *cmd, char **arg)
{
pid_t pid;
{
pid_t pid;
- context_save();
fflush(stdout);
fflush(stdout);
-
switch (pid = fork()) {
case -1:
/* fork error */
advise("fork", "unable to");
switch (pid = fork()) {
case -1:
/* fork error */
advise("fork", "unable to");
- return 1;
+ return -1;
case 0:
/* child */
execvp(cmd, arg);
fprintf(stderr, "unable to exec ");
perror(cmd);
case 0:
/* child */
execvp(cmd, arg);
fprintf(stderr, "unable to exec ");
perror(cmd);
- _exit(-1);
+ _exit(EX_OSERR);
default:
/* parent */
default:
/* parent */
- return (pidwait(pid, -1) & 0377 ? 1 : 0);
+ return pidXwait(pid, cmd);
}
}
- return 1; /* NOT REACHED */
+ return -1; /* NOT REACHED */
}
}