xref: /csrg-svn/lib/libc/gen/psignal.c (revision 26576)
110901Ssam /*
221353Sdist  * Copyright (c) 1980 Regents of the University of California.
321353Sdist  * All rights reserved.  The Berkeley software License Agreement
421353Sdist  * specifies the terms and conditions for redistribution.
521353Sdist  */
621353Sdist 
7*26576Sdonn #if defined(LIBC_SCCS) && !defined(lint)
8*26576Sdonn static char sccsid[] = "@(#)psignal.c	5.2 (Berkeley) 03/09/86";
9*26576Sdonn #endif LIBC_SCCS and not lint
1021353Sdist 
1121353Sdist /*
1210901Ssam  * Print the name of the signal indicated
1310901Ssam  * along with the supplied message.
1410901Ssam  */
1510901Ssam #include <signal.h>
1610901Ssam 
1710901Ssam extern	char *sys_siglist[];
1810901Ssam 
1910901Ssam psignal(sig, s)
2010901Ssam 	unsigned sig;
2110901Ssam 	char *s;
2210901Ssam {
2310901Ssam 	register char *c;
2410901Ssam 	register n;
2510901Ssam 
2610901Ssam 	c = "Unknown signal";
2710901Ssam 	if (sig < NSIG)
2810901Ssam 		c = sys_siglist[sig];
2910901Ssam 	n = strlen(s);
3010901Ssam 	if (n) {
3110901Ssam 		write(2, s, n);
3210901Ssam 		write(2, ": ", 2);
3310901Ssam 	}
3410901Ssam 	write(2, c, strlen(c));
3510901Ssam 	write(2, "\n", 1);
3610901Ssam }
37