]> diplodocus.org Git - nmh/blobdiff - sbr/pidstatus.c
Removed export of most of the variables in test/common.sh.in. The
[nmh] / sbr / pidstatus.c
index 7991d5925a6a22cb385496a15f42d33517a0a18c..1c1f734896455c19efe4f827a5a2d3b16e72001d 100644 (file)
@@ -2,8 +2,6 @@
 /*
  * 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 <sigmsg.h>
 
-#ifdef HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-
 #ifndef WTERMSIG
 # define WTERMSIG(s) ((int)((s) & 0x7F))
 #endif
 # define WCOREDUMP(s) ((s) & 0x80)
 #endif
 
+/*
+ * Return 0 if the command exited with an exit code of zero, a nonzero code
+ * otherwise.
+ *
+ * Print out an appropriate status message we didn't exit with an exit code
+ * of zero.
+ */
+
 int
 pidstatus (int status, FILE *fp, char *cp)
 {
@@ -48,6 +50,7 @@ pidstatus (int status, FILE *fp, char *cp)
                fprintf (fp, "%s: ", cp);
            fprintf (fp, "exit %d\n", signum);
        }
+       return signum;
     } else if (WIFSIGNALED(status)) {
        /* If child process terminated due to receipt of a signal */
        signum = WTERMSIG(status);
@@ -55,7 +58,8 @@ pidstatus (int status, FILE *fp, char *cp)
            if (cp)
                fprintf (fp, "%s: ", cp);
            fprintf (fp, "signal %d", signum);
-           if (signum >= 0 && signum < sizeof(sigmsg) && sigmsg[signum] != NULL)
+           if (signum >= 0 && signum < (int) sizeof(sigmsg) &&
+                  sigmsg[signum] != NULL)
                fprintf (fp, " (%s%s)\n", sigmsg[signum],
                         WCOREDUMP(status) ? ", core dumped" : "");
            else