diff options
Diffstat (limited to 'src/except.c')
-rw-r--r-- | src/except.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/except.c b/src/except.c index edee976..2d2df4a 100644 --- a/src/except.c +++ b/src/except.c @@ -1,7 +1,8 @@ #include <unistd.h> -#include "wait.h" -#include "logmsg.h" + #include "exit.h" +#include "logmsg.h" +#include "wait.h" #define WHO "except" @@ -10,25 +11,21 @@ int main(int argc, char **argv) int pid; int wstat; - if (!argv[1]) - logmsg(WHO,100,USAGE,"except program [ arg ... ]"); + if (!argv[1]) logmsg(WHO, 100, USAGE, "except program [ arg ... ]"); pid = fork(); - if (pid == -1) - logmsg(WHO,111,FATAL,"unable to fork: "); + if (pid == -1) logmsg(WHO, 111, FATAL, "unable to fork: "); if (pid == 0) { - execvp(argv[1],argv + 1); + execvp(argv[1], argv + 1); if (errno) _exit(111); _exit(100); } - if (wait_pid(&wstat,pid) == -1) - logmsg(WHO,111,FATAL,"wait failed"); - if (wait_crashed(wstat)) - logmsg(WHO,111,FATAL,"child crashed"); + if (wait_pid(&wstat, pid) == -1) logmsg(WHO, 111, FATAL, "wait failed"); + if (wait_crashed(wstat)) logmsg(WHO, 111, FATAL, "child crashed"); switch (wait_exitcode(wstat)) { - case 0: _exit(100); - case 111: logmsg(WHO,111,FATAL,"temporary child error"); - default: _exit(0); + case 0: _exit(100); + case 111: logmsg(WHO, 111, FATAL, "temporary child error"); + default: _exit(0); } } |