2 * UCW Library -- Formatting of Process Exit Status
4 * (c) 2004 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
11 #include <ucw/process.h>
18 format_exit_status(char *msg, int stat)
21 sprintf(msg, "failed to fork (err=%d)", errno);
22 else if (WIFEXITED(stat) && WEXITSTATUS(stat) < 256)
24 if (WEXITSTATUS(stat))
25 sprintf(msg, "died with exit code %d", WEXITSTATUS(stat));
32 else if (WIFSIGNALED(stat))
33 sprintf(msg, "died on signal %d", WTERMSIG(stat));
35 sprintf(msg, "died with status %x", stat);