1 /* pidstatus.c - report child's status */
3 static char ident[] = "@(#)$Id: pidstatus.c,v 1.4 1993/02/26 21:57:34 jromine Exp $";
13 static char *sigs[] = {
18 "Illegal instruction",
31 "Urgent I/O condition",
39 "Stopped (tty input)",
40 "Stopped (tty output)",
41 "Tty input interrupt",
42 "Cputime limit exceeded",
43 "Filesize limit exceeded",
47 extern char *sys_siglist[];
49 #endif /* BSD44 defines sys_siglist in signal.h */
53 int pidstatus (status, fp, cp)
60 if ((status & 0xff00) == 0xff00)
63 switch (signum = status & 0x007f) {
65 if (signum = ((status & 0xff00) >> 8)) {
67 fprintf (fp, "%s: ", cp);
68 fprintf (fp, "Exit %d\n", signum);
77 fprintf (fp, "%s: ", cp);
79 if (signum >= sizeof sigs || sigs[signum] == NULL)
80 fprintf (fp, "Signal %d", signum);
82 fprintf (fp, "%s", sigs[signum]);
85 fprintf (fp, "Signal %d", signum);
87 fprintf (fp, "%s", sys_siglist[signum]);
89 fprintf (fp, "%s\n", status & 0x80 ? " (core dumped)" : "");