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.
17 format_exit_status(char *msg, int stat)
20 sprintf(msg, "failed to fork (err=%d)", errno);
21 else if (WIFEXITED(stat) && WEXITSTATUS(stat) < 256)
23 if (WEXITSTATUS(stat))
24 sprintf(msg, "died with exit code %d", WEXITSTATUS(stat));
31 else if (WIFSIGNALED(stat))
32 sprintf(msg, "died on signal %d", WTERMSIG(stat));
34 sprintf(msg, "died with status %x", stat);