void eprint_status (const char* command, int status) { if (status == 0) return; eprintf ("%s: status 0x%04X", command, status); if (WIFEXITED (status)) { eprintf (", exit %d", WEXITSTATUS (status)); } if (WIFSIGNALED (status)) { eprint_signal ("Terminated", WTERMSIG (status)); #ifdef WCOREDUMP if (WCOREDUMP (status)) eprintf (", core dumped"); #endif } if (WIFSTOPPED (status)) { eprint_signal ("Stopped", WSTOPSIG (status)); } if (WIFCONTINUED (status)) { eprintf (", Continued"); } eprintf ("\n"); }
// Print the status, signal, and core of an exiting process. void eprint_status (char *command, int status) { fflush (NULL); if (status == 0) return; fprintf (stderr, "%s: status 0x%04X", command, status); if (WIFEXITED (status)) { fprintf (stderr, ", exit %d", WEXITSTATUS (status)); } // LINTED (warning: cast from 32-bit integer to 8-bit integer) if (WIFSIGNALED (status)) { eprint_signal ("Terminated", WTERMSIG (status)); #ifdef WCOREDUMP if (WCOREDUMP (status)) fprintf (stderr, ", core dumped"); #endif } if (WIFSTOPPED (status)) { eprint_signal ("Stopped", WSTOPSIG (status)); } if (WIFCONTINUED (status)) { fprintf (stderr, ", Continued"); } fprintf (stderr, "\n"); fflush (NULL); }