DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T p

⟦f558023a8⟧ TextFile

    Length: 1637 (0x665)
    Types: TextFile
    Names: »pidstatus.c«

Derivation

└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
    └─⟦3658e588a⟧ »EurOpenD3/mail/mh/mh-6.7.tar.Z« 
        └─⟦c75e36ecb⟧ 
            └─⟦this⟧ »mh-6.7/sbr/pidstatus.c« 

TextFile

/* pidstatus.c - report child's status */

#include "../h/mh.h"
#include <signal.h>
#include <stdio.h>


#ifndef	BSD42
static char *sigs[] = {
    NULL,
    "Hangup",
    "Interrupt",
    "Quit",
    "Illegal instruction",
    "Trace/BPT trap",
    "IOT trap",
    "EMT trap",
    "Floating exception",
    "Killed",
    "Bus error",
    "Segmentation fault",
    "Bad system call",
    "Broken pipe",
    "Alarm clock",
    "Terminated",
#ifdef	SIGURG
    "Urgent I/O condition",
#else
    NULL,
#endif
    "Stopped (signal)",
    "Stopped",
    "Continued",
    "Child exited",
    "Stopped (tty input)",
    "Stopped (tty output)",
    "Tty input interrupt",
    "Cputime limit exceeded",
    "Filesize limit exceeded",
    NULL
};
#else
extern  char *sys_siglist[];
#endif	BSD42

/* \f

 */

int	pidstatus (status, fp, cp)
register int   status;
register FILE *fp;
register char *cp;
{
    int     signum;

    if ((status & 0xff00) == 0xff00)
	return status;

    switch (signum = status & 0x007f) {
	case OK: 
	    if (signum = ((status & 0xff00) >> 8)) {
		if (cp)
		    fprintf (fp, "%s: ", cp);
		fprintf (fp, "Exit %d\n", signum);
	    }
	    break;

	case SIGINT: 
	    break;

	default: 
	    if (cp)
		fprintf (fp, "%s: ", cp);
#ifndef	BSD42
	    if (signum >= sizeof sigs || sigs[signum] == NULL)
		fprintf (fp, "Signal %d", signum);
	    else
		fprintf (fp, "%s", sigs[signum]);
#else	BSD42
	    if (signum >= NSIG)
		fprintf (fp, "Signal %d", signum);
	    else
		fprintf (fp, "%s", sys_siglist[signum]);
#endif	BSD42
	    fprintf (fp, "%s\n", status & 0x80 ? " (core dumped)" : "");
	    break;
    }

    return status;
}