]> git.marmaro.de Git - mmh/blobdiff - sbr/pidstatus.c
Removed the draft message in favor for a consistent draft folder facility
[mmh] / sbr / pidstatus.c
index aa664649a887a5fc901523b8fd45c3c70fff4690..6f5f5785c52c45b7a4f7bd21e7128a5499e19562 100644 (file)
@@ -1,8 +1,9 @@
-
 /*
  * pidstatus.c -- report child's status
  *
- * $Id$
+ * 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 <h/mh.h>
 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;
 }