X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fpidstatus.c;h=ff8cf48a0a056473cad47a27b37a70a45930c65a;hp=f16f7e0b77208f6b94b22ecbaabcbbd590030ee8;hb=ced6090a330d3d83d0bce709f756aa3d7d65fea4;hpb=5dd6771b28c257af405d7248639ed0e3bcdce38b diff --git a/sbr/pidstatus.c b/sbr/pidstatus.c index f16f7e0..ff8cf48 100644 --- a/sbr/pidstatus.c +++ b/sbr/pidstatus.c @@ -1,17 +1,16 @@ - /* - * pidstatus.c -- report child's status - * - * This code is Copyright (c) 2002, by the authors of nmh. See the - * COPYRIGHT file in the root directory of the nmh distribution for - * complete copyright information. - */ +** pidstatus.c -- report child's status +** +** This code is Copyright (c) 2002, by the authors of nmh. See the +** COPYRIGHT file in the root directory of the nmh distribution for +** complete copyright information. +*/ #include /* - * auto-generated header - */ +** auto-generated header +*/ #include #ifdef HAVE_SYS_WAIT_H @@ -29,37 +28,37 @@ int pidstatus (int status, FILE *fp, char *cp) { - int signum; + int signum; -/* - * I have no idea what this is for (rc) - * so I'm commenting it out for right now. - * - * if ((status & 0xff00) == 0xff00) - * return status; - */ + /* + ** I have no idea what this is for (rc) + ** so I'm commenting it out for right now. + ** + ** if ((status & 0xff00) == 0xff00) + ** return status; + */ - /* If child process returned normally */ - if (WIFEXITED(status)) { - if ((signum = WEXITSTATUS(status))) { - if (cp) - fprintf (fp, "%s: ", cp); - fprintf (fp, "exit %d\n", signum); - } - } else if (WIFSIGNALED(status)) { - /* If child process terminated due to receipt of a signal */ - signum = WTERMSIG(status); - if (signum != SIGINT) { - if (cp) - fprintf (fp, "%s: ", cp); - fprintf (fp, "signal %d", signum); - if (signum >= 0 && signum < sizeof(sigmsg) && sigmsg[signum] != NULL) - fprintf (fp, " (%s%s)\n", sigmsg[signum], - WCOREDUMP(status) ? ", core dumped" : ""); - else - fprintf (fp, "%s\n", WCOREDUMP(status) ? " (core dumped)" : ""); + /* If child process returned normally */ + if (WIFEXITED(status)) { + if ((signum = WEXITSTATUS(status))) { + if (cp) + fprintf (fp, "%s: ", cp); + fprintf (fp, "exit %d\n", signum); + } + } else if (WIFSIGNALED(status)) { + /* If child process terminated due to receipt of a signal */ + signum = WTERMSIG(status); + if (signum != SIGINT) { + if (cp) + fprintf (fp, "%s: ", cp); + fprintf (fp, "signal %d", signum); + if (signum >= 0 && signum < sizeof(sigmsg) && sigmsg[signum] != NULL) + fprintf (fp, " (%s%s)\n", sigmsg[signum], + WCOREDUMP(status) ? ", core dumped" : ""); + else + fprintf (fp, "%s\n", WCOREDUMP(status) ? " (core dumped)" : ""); + } } - } - return status; + return status; }