]>
diplodocus.org Git - nmh/blob - sbr/pidstatus.c
1 /* pidstatus.c -- report child's status
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
11 * Return 0 if the command exited with an exit code of zero, a nonzero code
14 * Print out an appropriate status message we didn't exit with an exit code
19 pidstatus (int status
, FILE *fp
, char *cp
)
26 if (WIFEXITED(status
)) {
27 status
= WEXITSTATUS(status
);
30 fprintf (fp
, "%s: ", cp
);
31 fprintf(fp
, "exited %d\n", status
);
36 if (WIFSIGNALED(status
)) {
38 num
= WTERMSIG(status
);
42 } else if (WIFSTOPPED(status
)) {
44 num
= WSTOPSIG(status
);
46 } else if (WIFCONTINUED(status
)) {
51 mesg
= "bizarre wait(2) status";
57 fprintf(fp
, "%s: ", cp
);
61 fprintf(fp
, " %#x", num
);
64 signame
= strsignal(num
);
71 if (WCOREDUMP(status
))
72 fputs(", core dumped", fp
);