xref: /csrg-svn/lib/libc/gen/psignal.c (revision 42625)
110901Ssam /*
235285Sbostic  * Copyright (c) 1983 Regents of the University of California.
335285Sbostic  * All rights reserved.
435285Sbostic  *
5*42625Sbostic  * %sccs.include.redist.c%
621353Sdist  */
721353Sdist 
826576Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*42625Sbostic static char sccsid[] = "@(#)psignal.c	5.4 (Berkeley) 06/01/90";
1035285Sbostic #endif /* LIBC_SCCS and not lint */
1121353Sdist 
1221353Sdist /*
1310901Ssam  * Print the name of the signal indicated
1410901Ssam  * along with the supplied message.
1510901Ssam  */
1610901Ssam #include <signal.h>
1710901Ssam 
1810901Ssam extern	char *sys_siglist[];
1910901Ssam 
2010901Ssam psignal(sig, s)
2135285Sbostic 	unsigned int sig;
2210901Ssam 	char *s;
2310901Ssam {
2410901Ssam 	register char *c;
2535285Sbostic 	register int n;
2610901Ssam 
2710901Ssam 	if (sig < NSIG)
2810901Ssam 		c = sys_siglist[sig];
2935285Sbostic 	else
3035285Sbostic 		c = "Unknown signal";
3110901Ssam 	n = strlen(s);
3210901Ssam 	if (n) {
3335285Sbostic 		(void)write(2, s, n);
3435285Sbostic 		(void)write(2, ": ", 2);
3510901Ssam 	}
3635285Sbostic 	(void)write(2, c, strlen(c));
3735285Sbostic 	(void)write(2, "\n", 1);
3810901Ssam }
39